diff options
m--------- | reqs/simple-opt | 0 | ||||
-rw-r--r-- | src/opt.c | 26 | ||||
-rw-r--r-- | src/opt.h | 3 |
3 files changed, 26 insertions, 3 deletions
diff --git a/reqs/simple-opt b/reqs/simple-opt -Subproject 197d36e32ddf85b49e82d5b84b9170f25f844ec +Subproject 4fd21e3125c3003ecd0ae28c50c8656b62faefb @@ -14,9 +14,13 @@ static struct simple_opt options[] = { { SIMPLE_OPT_FLAG, 'v', "version", false, "print the version of every in use and exit" }, { SIMPLE_OPT_STRING, 'c', "calendar", true, - "path to calendar file", "<file>" }, + "path to calendar file", "FILE" }, { SIMPLE_OPT_STRING, 'e', "editor", true, - "text editor for editing calendars", "<cmd>" }, + "text editor for editing calendars", "CMD" }, + { SIMPLE_OPT_CHAR, '\0', "line-delim", true, + "line delimiter for scripting output" }, + { SIMPLE_OPT_CHAR, '\0', "col-delim", true, + "column delimiter for scripting output" }, { SIMPLE_OPT_END } }; @@ -36,7 +40,7 @@ void opt_parse(int argc, char **argv) if (options[0].was_seen) { simple_opt_print_usage(stdout, 80, argv[0], "[-c CALENDAR_FILE] [-e TEXT_EDITOR] [COMMAND]", - "every is a flexible, console-based event calendar", + "every is a simple console-based event calendar", options); printf( @@ -95,6 +99,22 @@ char* opt_editor(void) return getenv("EDITOR"); } +char opt_line_delim(void) +{ + if (options[4].was_seen) + return options[4].val.v_char; + + return '\n'; +} + +char opt_col_delim(void) +{ + if (options[5].was_seen) + return options[5].val.v_char; + + return '\t'; +} + enum opt_command_e opt_command(void) { if (result.argc > 0) { @@ -12,6 +12,9 @@ void opt_parse(int argc, char **argv); char* opt_calpath(void); char* opt_editor(void); +char opt_line_delim(void); +char opt_col_delim(void); + enum opt_command_e opt_command(void); #endif |