Improved help command

This commit is contained in:
Sven Heidemann 2021-03-03 19:47:55 +01:00
parent 2174cf3701
commit d5975ea7ba
3 changed files with 25 additions and 29 deletions

View File

@ -22,18 +22,10 @@
<select /> <select />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Improved gitignore"> <list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Added version and help cli command">
<change afterPath="$PROJECT_DIR$/src/cpl_cli/command.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/cpl_cli/command_handler.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/cpl_cli/commands/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/cpl_cli/commands/help.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/cpl_cli/commands/version.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl/application/application_abc.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/application/application_abc.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/cli.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/cli.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/cpl_cli/cli.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/cli.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/cpl_cli/startup.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/startup.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/cpl_cli/commands/help.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/commands/help.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/Application.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/application.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/tests/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/main.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -494,20 +486,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1605881914521</updated> <updated>1605881914521</updated>
</task> </task>
<task id="LOCAL-00036" summary="Added console module">
<created>1607976626173</created>
<option name="number" value="00036" />
<option name="presentableId" value="LOCAL-00036" />
<option name="project" value="LOCAL" />
<updated>1607976626173</updated>
</task>
<task id="LOCAL-00037" summary="Improved console">
<created>1608037411172</created>
<option name="number" value="00037" />
<option name="presentableId" value="LOCAL-00037" />
<option name="project" value="LOCAL" />
<updated>1608037411172</updated>
</task>
<task id="LOCAL-00038" summary="Improved console"> <task id="LOCAL-00038" summary="Improved console">
<created>1608047595029</created> <created>1608047595029</created>
<option name="number" value="00038" /> <option name="number" value="00038" />
@ -837,7 +815,21 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1614793114078</updated> <updated>1614793114078</updated>
</task> </task>
<option name="localTasksCounter" value="85" /> <task id="LOCAL-00085" summary="Improved application">
<created>1614796638499</created>
<option name="number" value="00085" />
<option name="presentableId" value="LOCAL-00085" />
<option name="project" value="LOCAL" />
<updated>1614796638499</updated>
</task>
<task id="LOCAL-00086" summary="Added version and help cli command">
<created>1614796655760</created>
<option name="number" value="00086" />
<option name="presentableId" value="LOCAL-00086" />
<option name="project" value="LOCAL" />
<updated>1614796655760</updated>
</task>
<option name="localTasksCounter" value="87" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -853,8 +845,6 @@
<option name="oldMeFiltersMigrated" value="true" /> <option name="oldMeFiltersMigrated" value="true" />
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="Changed deps" />
<MESSAGE value="Removed publisher.py" />
<MESSAGE value="Added first steps of database command" /> <MESSAGE value="Added first steps of database command" />
<MESSAGE value="Improved error handling" /> <MESSAGE value="Improved error handling" />
<MESSAGE value="Improved service providing" /> <MESSAGE value="Improved service providing" />
@ -878,7 +868,9 @@
<MESSAGE value="Improved configuration" /> <MESSAGE value="Improved configuration" />
<MESSAGE value="Added cli application" /> <MESSAGE value="Added cli application" />
<MESSAGE value="Improved gitignore" /> <MESSAGE value="Improved gitignore" />
<option name="LAST_COMMIT_MESSAGE" value="Improved gitignore" /> <MESSAGE value="Improved application" />
<MESSAGE value="Added version and help cli command" />
<option name="LAST_COMMIT_MESSAGE" value="Added version and help cli command" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View File

@ -19,6 +19,7 @@ class CLI(ApplicationABC):
self._command_handler: CommandHandler = self._services.get_service(CommandHandler) self._command_handler: CommandHandler = self._services.get_service(CommandHandler)
# self._command_handler.add_command(Command('build', ['b', 'B'])) # self._command_handler.add_command(Command('build', ['b', 'B']))
# self._command_handler.add_command(Command('generate', ['g', 'G']))
self._command_handler.add_command(Command('help', ['h', 'H'], self._services.get_service(Help))) self._command_handler.add_command(Command('help', ['h', 'H'], self._services.get_service(Help)))
# self._command_handler.add_command(Command('new', ['n', 'N'])) # self._command_handler.add_command(Command('new', ['n', 'N']))
# self._command_handler.add_command(Command('publish', ['p', 'P'])) # self._command_handler.add_command(Command('publish', ['p', 'P']))

View File

@ -11,9 +11,12 @@ class Help(ServiceABC):
Console.write_line('Available Commands:') Console.write_line('Available Commands:')
commands = [ commands = [
['build (-b|-B)', 'Prepares files for publishing into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.'], ['build (-b|-B)', 'Prepares files for publishing into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.'],
['generate (-g|-G)', 'Generate a new file.'],
['help (-h|-H)', 'Lists available commands and their short descriptions.'], ['help (-h|-H)', 'Lists available commands and their short descriptions.'],
['new', 'Creates a new file or package.'], ['new (-n|-N)', 'Creates new CPL project.'],
['start (-s|-S)', 'Starts CPL project, restarting on file changes'],
['publish (-p|-P)', 'Prepares files for publishing into an output directory named dist/ at the given output path and executes setup.py. Must be executed from within a workspace directory.'], ['publish (-p|-P)', 'Prepares files for publishing into an output directory named dist/ at the given output path and executes setup.py. Must be executed from within a workspace directory.'],
['update (-u|-u)', 'Update CPL and project dependencies.'],
['version (-v|-V)', 'Outputs CPL CLI version.'] ['version (-v|-V)', 'Outputs CPL CLI version.']
] ]
for name, description in commands: for name, description in commands: