Skip to content

Commit

Permalink
Added --process-and-exit command line option to parse log and exit.
Browse files Browse the repository at this point in the history
  • Loading branch information
allinurl committed Jan 8, 2017
1 parent cbde81d commit dcc5bbd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/goaccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,9 @@ main (int argc, char **argv)
time (&end_proc);

/* stdout */
if (conf.output_stdout)
if (conf.process_and_exit) {
/* ignore outputting, process only */
} else if (conf.output_stdout)
standard_output ();
/* curses */
else
Expand Down
8 changes: 7 additions & 1 deletion src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ struct option long_opts[] = {
{"hour-spec" , required_argument , 0 , 0 } ,
{"html-custom-css" , required_argument , 0 , 0 } ,
{"html-custom-js" , required_argument , 0 , 0 } ,
{"html-report-title" , required_argument , 0 , 0 } ,
{"html-prefs" , required_argument , 0 , 0 } ,
{"html-report-title" , required_argument , 0 , 0 } ,
{"ignore-crawlers" , no_argument , 0 , 0 } ,
{"ignore-panel" , required_argument , 0 , 0 } ,
{"ignore-referer" , required_argument , 0 , 0 } ,
Expand All @@ -114,6 +114,7 @@ struct option long_opts[] = {
{"origin" , required_argument , 0 , 0 } ,
{"output" , required_argument , 0 , 0 } ,
{"port" , required_argument , 0 , 0 } ,
{"process-and-exit" , no_argument , 0 , 0 } ,
{"real-os" , no_argument , 0 , 0 } ,
{"real-time-html" , no_argument , 0 , 0 } ,
{"sort-panel" , required_argument , 0 , 0 } ,
Expand Down Expand Up @@ -237,6 +238,7 @@ cmd_help (void)
" are allowed. i.e., *.bing.com\n"
" --ignore-status=<CODE> - Ignore parsing the given status code.\n"
" --num-tests=<number> - Number of lines to test. >= 0 (10 default)\n"
" --process-and-exit - Parse log and exit without outputting data.\n"
" --real-os - Display real OS names. e.g, Windows XP, Snow\n"
" Leopard.\n"
" --sort-panel=PANEL,METRIC,ORDER - Sort panel on initial load. For example:\n"
Expand Down Expand Up @@ -541,6 +543,10 @@ parse_long_opt (const char *name, const char *oarg)
conf.num_tests = tests;
}

/* process and exit */
if (!strcmp ("process-and-exit", name))
conf.process_and_exit = 1;

/* real os */
if (!strcmp ("real-os", name))
conf.real_os = 1;
Expand Down
1 change: 1 addition & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ typedef struct GConf_
int no_tab_scroll; /* don't scroll dashboard on tab */
int num_tests; /* number of lines to test */
int output_stdout; /* outputting to stdout */
int process_and_exit; /* parse and exit without outputting */
int real_os; /* show real OSs */
int real_time_html; /* enable real-time HTML output */
int skip_term_resolver; /* no terminal resolver */
Expand Down

0 comments on commit dcc5bbd

Please sign in to comment.