shell_utils
drunc.unified_shell.shell_utils
Classes
Functions
generate_fsm_sequence_command(ctx, sequence, controller_name)
Parse a FSM sequence and generate a Click command to run it.
This command extracts the OKS FSMsequence object attributes and generates a Click command that runs the sequence by invoking the individual commands in order. The generated command includes options for all parameters of the individual commands in the sequence.
Note - "sequence" is the name of the FSMsequence, "sequence_command" is the name of an individual command in the sequence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
Context
|
The Click context. |
required |
sequence
|
FSMsequence
|
The FSM sequence object. |
required |
controller_name
|
str
|
The name of the controller. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
The generated Click command and its name. |
Source code in drunc/unified_shell/shell_utils.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
run_fsm_sequence(sequence_commands, sequence_command_opts_and_args, ctx, obj, **kwargs)
Execute a command sequence by invoking individual commands in order.
This function takes a list of command names representing a sequence and invokes each command in order using the provided Click context. It gathers the necessary options and arguments for each command from the provided keyword arguments.
Note - sequence commands are the names of the commands in the sequence, while the sequence name is the name of the overall sequence being executed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sequence_commands
|
list[str]
|
List of command names to execute in order. |
required |
sequence_command_opts_and_args
|
dict[str, list[str]]
|
Mapping of sequence command names to their options and arguments. |
required |
ctx
|
Context
|
The Click context for invoking commands. |
required |
obj
|
Context
|
The object passed to commands, typically containing shared state. |
required |
**kwargs
|
Additional keyword arguments representing command options and arguments. |
{}
|