Added build command to cli
This commit is contained in:
@@ -15,16 +15,14 @@ class Interpreter:
|
||||
|
||||
def interpret(self, input_string: str):
|
||||
input_list = input_string.split(' ')
|
||||
commands = [type(cmd).__name__.lower() for cmd in self._commands]
|
||||
command = input_list[0]
|
||||
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:
|
||||
Console.error(f'Unexpected command {command}')
|
||||
Console.error('Run \'cpl help\'')
|
||||
args = input_list[1:] if len(input_list) > 1 else []
|
||||
|
||||
cmd = next(
|
||||
(cmd for cmd in self._commands if type(cmd).__name__.lower() == command or command in cmd.aliases),
|
||||
None)
|
||||
if cmd is not None:
|
||||
cmd.run(args)
|
||||
else:
|
||||
Console.error(f'Unexpected command {command}')
|
||||
Console.error('Run \'cpl help\'')
|
||||
|
||||
Reference in New Issue
Block a user