diff --git a/CMakeLists.txt b/CMakeLists.txt index d7686a8..e262b83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,8 +115,13 @@ if(BUILD_TESTING) COMMAND tmux-mem-cpu-load --graph_lines -2 ) + add_test(NAME old_option_specification + COMMAND tmux-mem-cpu-load 2 8 + ) + set_tests_properties(usage invalid_status_interval invalid_graph_lines + old_option_specification PROPERTIES WILL_FAIL TRUE) endif() diff --git a/README.rst b/README.rst index 9cf0128..90d885d 100644 --- a/README.rst +++ b/README.rst @@ -86,18 +86,34 @@ Edit ``$HOME/.tmux.conf`` to display the program's output in *status-left* or *status-right*. For example:: set -g status-interval 2 - set -g status-left "#S #[fg=green,bg=black]#(tmux-mem-cpu-load --colors 2)#[default]" + set -g status-left "#S #[fg=green,bg=black]#(tmux-mem-cpu-load --colors --interval 2)#[default]" -Note that the first argument to `tmux-mem-cpu-load` should be the same number +Note that the *interval* argument to `tmux-mem-cpu-load` should be the same number of seconds that *status-interval* is set at. -An optional second argument is the number of bars in the bar graph, which +Another optional argument is the number of bars in the bar graph, which defaults to 10. This can, for instance, be set to the number of cores in a multi-core system. +The *colors* option will add graded colors for each of the measures. -Author -====== +The full usage:: + + Usage: tmux-mem-cpu-load [OPTIONS] + + Available options: + -h, --help + Prints this help message + --colors + Use tmux colors in output + -i , --interval + Set tmux status refresh interval in seconds. Default: 1 second + -g , --graph-lines + Set how many lines should be drawn in a graph. Default: 10 + + +Authors +======= Matt McCormick (thewtex) diff --git a/tmux-mem-cpu-load.cc b/tmux-mem-cpu-load.cc index 737899a..2937a39 100644 --- a/tmux-mem-cpu-load.cc +++ b/tmux-mem-cpu-load.cc @@ -155,10 +155,18 @@ int main( int argc, char** argv ) return EXIT_FAILURE; break; default: - std::cout << "?? getopt returned character code 0 " << c << std::endl; + std::cerr << "?? getopt returned character code 0 " << c << std::endl; return EXIT_FAILURE; } } + // Detect old option specification and return and error message. + if( argc > optind ) + { + std::cout << + "The interval and graph lines options are now specified with flags.\n\n"; + print_help(); + return EXIT_FAILURE; + } std::cout << mem_string( use_colors ) << ' ' << cpu_string( cpu_usage_delay, graph_lines, use_colors ) << ' '