Bug Fix - parsing

- Now properly enumerates ambiguous commands.
- Now properly enumerates ambiguous colors.
- Now displays suitable error when a command like "task x" is entered.
This commit is contained in:
Paul Beckingham 2009-06-25 22:21:43 -04:00
parent d6168ff6a6
commit 53155fcc34
5 changed files with 11 additions and 4 deletions

View file

@ -26,6 +26,7 @@
113 Unrecognized character(s) at end of substitution 113 Unrecognized character(s) at end of substitution
114 Malformed substitution 114 Malformed substitution
115 Tags are not permitted to contain commas 115 Tags are not permitted to contain commas
116 You must specify a command, or a task ID to modify
# 2xx Commands - must be sequential # 2xx Commands - must be sequential
200 active 200 active

View file

@ -97,8 +97,6 @@ void Cmd::parse (const std::string& input)
std::string combined; std::string combined;
join (combined, ", ", matches); join (combined, ", ", matches);
error += combined;
throw error + combined; throw error + combined;
} }
} }

View file

@ -550,7 +550,14 @@ void Context::parse (
parseTask.set ("description", descCandidate); parseTask.set ("description", descCandidate);
} }
// TODO task.validate () ? // At this point, either a sequence or a command should have been found.
if (parseSequence.size () == 0 && parseCmd.command == "")
{
parseCmd.parse (descCandidate);
throw stringtable.get (
CMD_MISSING,
"You must specify a command, or a task ID to modify");
}
// Read-only command (reports, status, info ...) use filters. Write commands // Read-only command (reports, status, info ...) use filters. Write commands
// (add, done ...) do not. // (add, done ...) do not.

View file

@ -185,7 +185,6 @@ std::string guessColor (const std::string& name)
std::string combined; std::string combined;
join (combined, ", ", matches); join (combined, ", ", matches);
error += combined;
throw error + combined; throw error + combined;
} }

View file

@ -63,6 +63,8 @@
#define TAGS_NO_COMMA 115 #define TAGS_NO_COMMA 115
#define CMD_MISSING 116
// 2xx Commands // 2xx Commands
#define CMD_ACTIVE 200 #define CMD_ACTIVE 200
#define CMD_ADD 201 #define CMD_ADD 201