sh_cpl/src/cpl_cli/command/help_service.py

32 lines
1.6 KiB
Python
Raw Normal View History

2021-03-03 19:37:35 +01:00
from cpl.console.console import Console
2021-03-12 16:06:30 +01:00
from cpl.console.foreground_color_enum import ForegroundColorEnum
2021-03-04 17:36:02 +01:00
from cpl_cli.command_abc import CommandABC
2021-03-03 19:37:35 +01:00
2021-03-12 16:06:30 +01:00
class HelpService(CommandABC):
2021-03-03 19:37:35 +01:00
def __init__(self):
2021-03-04 17:36:02 +01:00
CommandABC.__init__(self)
2021-03-03 19:37:35 +01:00
def run(self, args: list[str]):
Console.write_line('Available Commands:')
commands = [
['build (b|B)', 'Prepares files for publish 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 command and their short descriptions.'],
2021-03-14 15:15:07 +01:00
['install (i|I)', 'With argument installs packages to project, without argument installs project dependencies.'],
['new (n|N)', 'Creates new CPL project.'],
['start (s|S)', 'Starts CPL project, restarting on file changes'],
2021-03-10 14:07:52 +01:00
['publish (p|P)', 'Prepares files for publish into an output directory named dist/ at the given output path and executes setup_template.py. Must be executed from within a workspace directory.'],
2021-03-14 15:15:07 +01:00
['uninstall (ui|UI)', 'Uninstalls packages from project.'],
['update (u|u)', 'Update CPL and project dependencies.'],
['version (v|V)', 'Outputs CPL CLI version.']
2021-03-03 19:37:35 +01:00
]
for name, description in commands:
2021-03-12 16:06:30 +01:00
Console.set_foreground_color(ForegroundColorEnum.blue)
2021-03-03 19:37:35 +01:00
Console.write(f'\n\t{name} ')
2021-03-12 16:06:30 +01:00
Console.set_foreground_color(ForegroundColorEnum.default)
2021-03-03 19:37:35 +01:00
Console.write(f'{description}')
Console.write('\n')