Detect old option specification fail informatively.

Print the information message to std::cout so it gets printed on the tmux
status line so users of 2.X know how to update their configuration.
This commit is contained in:
Matt McCormick 2015-01-19 22:51:14 -05:00
parent 4c00be77ff
commit 1bfda9484a
2 changed files with 13 additions and 0 deletions

@ -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()

@ -159,6 +159,14 @@ int main( int argc, char** argv )
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 ) << ' '