Skip to content

Commit 7fe53b5

Browse files
committed
fixed command definition
1 parent e0a53b1 commit 7fe53b5

2 files changed

Lines changed: 9 additions & 16 deletions

File tree

software/script/chameleon_cli_unit.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4728,17 +4728,9 @@ def on_exec(self, args: argparse.Namespace):
47284728

47294729

47304730
# Scripting commands
4731-
@root.command('script')
4732-
class ScriptRoot(BaseCLIUnit):
4733-
"""Script management and execution"""
4734-
4735-
def args_parser(self) -> ArgumentParserNoExit:
4736-
parser = ArgumentParserNoExit()
4737-
parser.description = 'Script management and execution'
4738-
return parser
4739-
4731+
script = root.subgroup('script', 'Script management and execution')
47404732

4741-
@ScriptRoot.command('run')
4733+
@script.command('run')
47424734
class ScriptRun(BaseCLIUnit):
47434735
"""Run a Python script"""
47444736

@@ -4795,7 +4787,7 @@ def on_exec(self, args):
47954787
print(f" [!] {color_string((CR, f'Error running script: {e}'))}")
47964788

47974789

4798-
@ScriptRoot.command('exec')
4790+
@script.command('exec')
47994791
class ScriptExec(BaseCLIUnit):
48004792
"""Execute Python code directly"""
48014793

@@ -4835,7 +4827,7 @@ def on_exec(self, args):
48354827
print(f" [!] {color_string((CR, f'Error executing code: {e}'))}")
48364828

48374829

4838-
@ScriptRoot.command('list')
4830+
@script.command('list')
48394831
class ScriptList(BaseCLIUnit):
48404832
"""List available scripts"""
48414833

@@ -4861,7 +4853,7 @@ def on_exec(self, args):
48614853
print(f" [!] {color_string((CR, f'Error listing scripts: {e}'))}")
48624854

48634855

4864-
@ScriptRoot.command('save')
4856+
@script.command('save')
48654857
class ScriptSave(BaseCLIUnit):
48664858
"""Save a script to file"""
48674859

@@ -4896,7 +4888,7 @@ def on_exec(self, args):
48964888
print(f" [!] {color_string((CR, f'Error saving script: {e}'))}")
48974889

48984890

4899-
@ScriptRoot.command('show')
4891+
@script.command('show')
49004892
class ScriptShow(BaseCLIUnit):
49014893
"""Show script content"""
49024894

@@ -4922,7 +4914,7 @@ def on_exec(self, args):
49224914
print(f" [!] {color_string((CR, f'Error showing script: {e}'))}")
49234915

49244916

4925-
@ScriptRoot.command('vars')
4917+
@script.command('vars')
49264918
class ScriptVars(BaseCLIUnit):
49274919
"""Show current script variables"""
49284920

@@ -4946,7 +4938,7 @@ def on_exec(self, args):
49464938
print(f" [!] {color_string((CR, f'Error showing variables: {e}'))}")
49474939

49484940

4949-
@ScriptRoot.command('clear')
4941+
@script.command('clear')
49504942
class ScriptClear(BaseCLIUnit):
49514943
"""Clear script variables"""
49524944

software/script/chameleon_script.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def execute_script(self, script_content: str, script_path: Optional[str] = None)
250250
'all': all,
251251
'abs': abs,
252252
'round': round,
253+
'time': time,
253254
}
254255
}
255256

0 commit comments

Comments
 (0)