CmdImport: Code cleanup

This commit is contained in:
Paul Beckingham 2017-01-29 12:17:44 -05:00
parent 31a85478f5
commit afd8b94c91

View file

@ -58,12 +58,13 @@ CmdImport::CmdImport ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int CmdImport::execute (std::string&) int CmdImport::execute (std::string&)
{ {
int rc = 0; auto rc = 0;
int count = 0; auto count = 0;
// Get filenames from command line arguments. // Get filenames from command line arguments.
std::vector <std::string> words = context.cli2.getWords (); auto words = context.cli2.getWords ();
if (! words.size () || (words.size () == 1 && words[0] == "-")) if (! words.size () ||
(words.size () == 1 && words[0] == "-"))
{ {
std::cout << format (STRING_CMD_IMPORT_FILE, "STDIN") << '\n'; std::cout << format (STRING_CMD_IMPORT_FILE, "STDIN") << '\n';
@ -101,7 +102,7 @@ int CmdImport::execute (std::string&)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int CmdImport::import (const std::string& input) int CmdImport::import (const std::string& input)
{ {
int count = 0; auto count = 0;
try try
{ {
json::value* root = json::parse (input); json::value* root = json::parse (input);
@ -171,12 +172,12 @@ void CmdImport::importSingleTask (json::object* obj)
// Parse the whole thing, validate the data. // Parse the whole thing, validate the data.
Task task (obj); Task task (obj);
bool hasGeneratedEntry = not task.has ("entry"); auto hasGeneratedEntry = not task.has ("entry");
bool hasExplicitEnd = task.has ("end"); auto hasExplicitEnd = task.has ("end");
task.validate (); task.validate ();
bool hasGeneratedEnd = not hasExplicitEnd and task.has ("end"); auto hasGeneratedEnd = not hasExplicitEnd and task.has ("end");
// Check whether the imported task is new or a modified existing task. // Check whether the imported task is new or a modified existing task.
Task before; Task before;