From e63b3ec88bdaa0c47b654574dc9520187811267c Mon Sep 17 00:00:00 2001 From: Ache Date: Tue, 5 Jul 2016 00:20:27 +0200 Subject: Majuscule -> Add So you can type : todo Clean the todo-list --- todo.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'todo.cpp') diff --git a/todo.cpp b/todo.cpp index 5addf63..3a234cb 100644 --- a/todo.cpp +++ b/todo.cpp @@ -4,7 +4,8 @@ #include #include #include -#include +#include +#include using namespace std; @@ -61,8 +62,13 @@ int main(int argc, char *argv[]) { color = true; vector listTodo; int action = -1; + int startArgv = 2; + if( argc > 1 ) - if( !strcmp( argv[1], "show") ) { + if( isalpha(argv[1][0]) && toupper(argv[1][0]) == argv[1][0] ) { + action = 1; + startArgv = 1; + }else if( !strcmp( argv[1], "show") ) { action = 0; }else if ( !strcmp( argv[1], "add") ) { action = 1; @@ -114,7 +120,7 @@ int main(int argc, char *argv[]) { case 1: { string sargv(""); - for( int i = 2 ; i < argc ; i++) { + for( int i = startArgv ; i < argc ; i++) { sargv += " "; sargv += argv[i]; } -- cgit v1.2.3