diff --git a/ChangeLog b/ChangeLog index cb5af252..2e4f4008 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,6 +41,7 @@ (thanks to Martin Boeker). - Added DOM support and a 'get' command. - Added 'totals.py' sample extension. +- Added extension list to the 'help' command. ------ old release --------------------------- diff --git a/src/commands/CmdHelp.cpp b/src/commands/CmdHelp.cpp index c8a01abc..e1292354 100644 --- a/src/commands/CmdHelp.cpp +++ b/src/commands/CmdHelp.cpp @@ -29,7 +29,7 @@ #include //////////////////////////////////////////////////////////////////////////////// -int CmdHelpUsage () +int CmdHelpUsage (const Extensions& extensions) { // TODO This is going to need more formatting. // TODO Align the arg types? @@ -65,8 +65,19 @@ int CmdHelpUsage () << " timew track [ ...]\n" << " timew untag @ [@ ...] [ ...]\n" << " timew week [] [ ...]\n" - << '\n' - << "Additional help:\n" + << '\n'; + + if (extensions.all ().size ()) + { + std::cout << "Extensions (extensions do not provide help):\n"; + + for (auto& ext : extensions.all ()) + std::cout << " " << File (ext).name () << '\n'; + + std::cout << '\n'; + } + + std::cout << "Additional help:\n" << " timew help \n" << " timew help interval\n" << " timew help hints\n" @@ -104,7 +115,9 @@ int CmdHelpUsage () // // Strict 80-character limit. // Provide examples where appropriate - enough to cover all uses. -int CmdHelp (const CLI& cli) +int CmdHelp ( + const CLI& cli, + const Extensions& extensions) { auto words = cli.getWords (); if (words.size ()) @@ -906,7 +919,7 @@ int CmdHelp (const CLI& cli) return 0; } - return CmdHelpUsage (); + return CmdHelpUsage (extensions); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/commands.h b/src/commands/commands.h index 26c48b6f..2758dc76 100644 --- a/src/commands/commands.h +++ b/src/commands/commands.h @@ -43,8 +43,8 @@ int CmdExtensions ( Rules&, const Extensions&); int CmdFill (const CLI&, Rules&, Database& ); int CmdGaps (const CLI&, Rules&, Database& ); int CmdGet (const CLI&, Rules&, Database& ); -int CmdHelpUsage ( ); -int CmdHelp (const CLI& ); +int CmdHelpUsage ( const Extensions&); +int CmdHelp (const CLI&, const Extensions&); int CmdJoin (const CLI&, Rules&, Database& ); int CmdLengthen (const CLI&, Rules&, Database& ); int CmdMove (const CLI&, Rules&, Database& ); diff --git a/src/init.cpp b/src/init.cpp index 667200b8..5443fcf1 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -268,7 +268,7 @@ int dispatchCommand ( */ else if (command == "gaps") status = CmdGaps (cli, rules, database ); else if (command == "get") status = CmdGet (cli, rules, database ); - else if (command == "help") status = CmdHelp (cli ); + else if (command == "help") status = CmdHelp (cli, extensions); else if (command == "join") status = CmdJoin (cli, rules, database ); else if (command == "lengthen") status = CmdLengthen (cli, rules, database ); else if (command == "month") status = CmdChartMonth (cli, rules, database );