Added version command to cli
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from sh_edraft.cli.command.base.command_base import CommandBase
|
||||
from sh_edraft.console.console import Console
|
||||
|
||||
|
||||
class Interpreter:
|
||||
@@ -16,13 +17,12 @@ class Interpreter:
|
||||
input_list = input_string.split(' ')
|
||||
commands = [type(cmd).__name__.lower() for cmd in self._commands]
|
||||
command = input_list[0]
|
||||
args = input_list[1:]
|
||||
print(command)
|
||||
args = input_list[1:] if len(input_list) > 2 else []
|
||||
if command in commands:
|
||||
cmd = next((cmd for cmd in self._commands if type(cmd).__name__.lower() == command), None)
|
||||
if cmd is not None:
|
||||
cmd.run(args)
|
||||
else:
|
||||
print(f'Unexpected command {command}')
|
||||
Console.error(f'Unexpected command {command}')
|
||||
else:
|
||||
print(f'Unexpected command {command}')
|
||||
Console.error(f'Unexpected command {command}')
|
||||
|
||||
Reference in New Issue
Block a user