aboutsummaryrefslogtreecommitdiffstats
path: root/src/actionparser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/actionparser.c')
-rw-r--r--src/actionparser.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/actionparser.c b/src/actionparser.c
index a1fd1ef..580eb01 100644
--- a/src/actionparser.c
+++ b/src/actionparser.c
@@ -123,7 +123,15 @@ int parse_LIST(UserOpt *opt) {
return 1;
}
int parse_SEARCH(UserOpt *opt) {
- return -1;
+ /* Search expects a maximum of 1 argument */
+ if (optNum > pos + 1) {
+ opt->err = PERR_SEARCH_WRONG;
+ return -1;
+ }
+
+ int arg_num = optNum - pos;
+ fill_args_list(arg_num, opt);
+ return 1;
}
int parse_HELP(UserOpt *opt) {
return -1;
@@ -272,7 +280,7 @@ void print_parser_error(UserOpt *opt) {
sprintf(errStr, "List programs, configs and more\nUsage: %s value-to-list (or tree) [-t list-type]", names);
break;
case PERR_SEARCH_WRONG:
- sprintf(errStr, "Usage: .............");
+ sprintf(errStr, "Search through the configs with grep\nUsage: %s search-term", names);
break;
case PERR_HELP_WRONG:
sprintf(errStr, "Usage: ........");