cleanup and add more statements to the cli for better ux
@@ -19,6 +19,7 @@ from st2client.models.aliasexecution import ActionAliasExecution
from st2client.commands import resource
from st2client.formatters import table
+
__all__ = [
'ActionAliasBranch',
'ActionAliasMatchCommand',
@@ -67,7 +68,9 @@ class ActionAliasMatchCommand(resource.ResourceCommand):
self.parser.add_argument('match_text',
metavar='command',
help=help)
-
+ self.parser.add_argument('-h', '--help',
+ action='store_true', dest='help',
+ help='Print usage for the given action.')
self.parser.add_argument('-a', '--attr', nargs='+',
default=self.display_attributes,
help=('List of attributes to include in the '
@@ -99,8 +102,7 @@ class ActionAliasExecuteCommand(resource.ResourceCommand):
super(ActionAliasExecuteCommand, self).__init__(
resource, 'execute',
('Execute the command text by finding a matching %s.' %
- resource.get_display_name().lower()),
- *args, **kwargs)
+ resource.get_display_name().lower()), *args, **kwargs)
self.parser.add_argument('command_text',
metavar='command',
@@ -108,27 +110,9 @@ class ActionAliasExecuteCommand(resource.ResourceCommand):
self.parser.add_argument('-h', '--help',
action='store_true', dest='help',
help='Print usage for the given action.')
- self.parser.add_argument('--trace-tag', '--trace_tag',
- help='A trace tag string to track execution later.',
- dest='trace_tag', required=False)
- self.parser.add_argument('--trace-id',
- help='Existing trace id for this execution.',
- dest='trace_id', required=False)
- self.parser.add_argument('-a', '--async',
- action='store_true', dest='async',
- help='Do not wait for action to finish.')
self.parser.add_argument('-u', '--user', type=str, default=None,
help='User under which to run the action (admins only).')
- self.parser.add_argument('--attr', nargs='+',
- default=self.display_attributes,
- help=('List of attributes to include in the '
- 'output. "all" will return all '
- 'attributes.'))
- self.parser.add_argument('-w', '--width', nargs='+', type=int,
- default=None,
- help=('Set the width of columns in output.'))
-
@resource.add_auth_token_to_kwargs_from_cli
def run(self, args, **kwargs):
alias_match = ActionAliasMatch()
@@ -152,4 +136,6 @@ class ActionAliasExecuteCommand(resource.ResourceCommand):
def run_and_print(self, args, **kwargs):
execution = self.run(args, **kwargs)
- print("Started execution, id '%s'" % execution.execution['id'])
+ print("Matching Action-alias: '%s'" % execution.actionalias['ref'])
+ print("To get the results, execute:\n st2 execution get %s" %
+ (execution.execution['id']))
