X-Git-Url: https://code.grnet.gr/git/kamaki/blobdiff_plain/be4eb3fac1f10e45745e5d17f87079e68f0f3eb9..59cadffbe83582bda5116ada81e97525be1ac616:/docs/developers/adding-commands.rst diff --git a/docs/developers/adding-commands.rst b/docs/developers/adding-commands.rst index e2dd13c..d9072db 100644 --- a/docs/developers/adding-commands.rst +++ b/docs/developers/adding-commands.rst @@ -85,9 +85,9 @@ Kamaki interfaces make use of this CommandTree structure. Optimizations are poss def command(cmd_tree, prefix='', descedants_depth=None): """Load a class as a command - @cmd_tree is the CommandTree to be updated with a new command - @prefix of the commands allowed to be inserted ('' for all) - @descedants_depth is the depth of the tree descedants of the + :param cmd_tree: is the CommandTree to be updated with a new command + :param prefix: of the commands allowed to be inserted ('' for all) + :param descedants_depth: is the depth of the tree descedants of the prefix command. """ @@ -125,7 +125,7 @@ The description of each command is the first line of the class commend. The foll Declare run-time argument ------------------------- -The argument mechanism allows the definition of run-time arguments. Some basic argument types are defined at the `argument module `_, but it is not uncommon to extent these classes in order to achieve specialized type checking and syntax control (e.g. at `pithos_cli module `_). +The argument mechanism allows the definition of run-time arguments. Some basic argument types are defined at the `argument module `_, but it is not uncommon to extent these classes in order to achieve specialized type checking and syntax control (e.g. at `pithos_cli module `_). To declare a run-time argument on a specific command, the object class should initialize a dict called *arguments* , where Argument objects are stored. Each argument object is a possible run-time argument. Syntax checking happens at client level, while the type checking is implemented in the Argument code (thus, many different Argument types might be needed). @@ -138,7 +138,7 @@ To declare a run-time argument on a specific command, the object class should in class mygrp1_list_details(): """list of details""" - def __init__(self, global_args={}) + def __init__(self, global_args={}): global_args['match'] = ValueArgument( 'Filter results to match string', '--match') @@ -149,8 +149,8 @@ The main method and command parameters The command behavior for each command / class is coded in *main*. The parameters of *main* method defines the command parameters part of the syntax. In specific:: - main(self, param) - obligatory parameter - main(self, param=None) - optional parameter + main(self, param) - obligatory parameter + main(self, param=None) - optional parameter [param] main(self, param1, param2=42) - [param2] main(self, param1____param2) - main(self, param1____param2=[]) - [param1:param2]