Commit 05171c29 authored by Leon Hiemstra's avatar Leon Hiemstra

made the 'cat' command more easy, removed -f option

parent d44c9c10
......@@ -396,18 +396,31 @@ CMDstatus CMD::Cat(int argc, char* argv[], TermOutput& termout, Serverdat *sd)
{
CMDstatus ret={CMD_STATUS_ERROR,0,0};
po::options_description desc("concatenate files and print on the standard output");
desc.add_options()
po::options_description generic("concatenate files and print on the standard output");
generic.add_options()
("help,h", "shows this help text")
;
po::options_description hidden("hidden options");
hidden.add_options()
("file,f", po::value<std::string>(), "filename")
;
po::options_description cmdline_options;
cmdline_options.add(generic).add(hidden);
po::options_description visible("Allowed options");
visible.add(generic);
try {
po::positional_options_description p;
p.add("file", -1);
po::variables_map vm;
po::store(po::parse_command_line(argc,argv,desc), vm);
po::store(po::command_line_parser(argc,argv).
options(cmdline_options).positional(p).run(), vm);
po::notify(vm);
if (vm.count("help")) {
termout.strout << "usage: " << CAT << " [options]" << endl << "Options: " << desc;
termout.strout << "usage: " << CAT << " [options]" << endl << "Options: " << generic;
return {CMD_STATUS_OK,0,0};
} else if (vm.count("file")) {
string filename=vm["file"].as<string>();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment