Revision 59cadffb
b/docs/developers/adding-commands.rst | ||
---|---|---|
85 | 85 |
|
86 | 86 |
def command(cmd_tree, prefix='', descedants_depth=None): |
87 | 87 |
"""Load a class as a command |
88 |
@cmd_tree is the CommandTree to be updated with a new command
|
|
89 |
@prefix of the commands allowed to be inserted ('' for all)
|
|
90 |
@descedants_depth is the depth of the tree descedants of the
|
|
88 |
:param cmd_tree: is the CommandTree to be updated with a new command
|
|
89 |
:param prefix: of the commands allowed to be inserted ('' for all)
|
|
90 |
:param descedants_depth: is the depth of the tree descedants of the
|
|
91 | 91 |
prefix command. |
92 | 92 |
""" |
93 | 93 |
|
... | ... | |
125 | 125 |
Declare run-time argument |
126 | 126 |
------------------------- |
127 | 127 |
|
128 |
The argument mechanism allows the definition of run-time arguments. Some basic argument types are defined at the `argument module <cli.html#module-kamaki.cli.argument>`_, 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 <cli.html#module-kamaki.cli.commands.pithos_cli>`_).
|
|
128 |
The argument mechanism allows the definition of run-time arguments. Some basic argument types are defined at the `argument module <code.html#module-kamaki.cli.argument>`_, 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 <code.html#module-kamaki.cli.commands.pithos_cli>`_).
|
|
129 | 129 |
|
130 | 130 |
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). |
131 | 131 |
|
... | ... | |
138 | 138 |
class mygrp1_list_details(): |
139 | 139 |
"""list of details""" |
140 | 140 |
|
141 |
def __init__(self, global_args={}) |
|
141 |
def __init__(self, global_args={}):
|
|
142 | 142 |
global_args['match'] = ValueArgument( |
143 | 143 |
'Filter results to match string', |
144 | 144 |
'--match') |
... | ... | |
149 | 149 |
|
150 | 150 |
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:: |
151 | 151 |
|
152 |
main(self, param) - obligatory parameter |
|
153 |
main(self, param=None) - optional parameter |
|
152 |
main(self, param) - obligatory parameter <param>
|
|
153 |
main(self, param=None) - optional parameter [param]
|
|
154 | 154 |
main(self, param1, param2=42) - <param1> [param2] |
155 | 155 |
main(self, param1____param2) - <param1:param2> |
156 | 156 |
main(self, param1____param2=[]) - [param1:param2] |
b/docs/index.rst | ||
---|---|---|
8 | 8 |
|
9 | 9 |
.. image:: /images/kamaki-logo.png |
10 | 10 |
|
11 |
./kamaki is a simple, yet intuitive, multipurpose command-line tool and client API for managing clouds. |
|
11 |
./kamaki is a simple, yet intuitive, multipurpose, interactive command-line tool and client API for managing clouds.
|
|
12 | 12 |
|
13 |
It is an initial implementation of the OpenStack Compute API, v1.1, with custom |
|
14 |
extensions specific to the Synnefo IaaS cloud management software. |
|
13 |
As a develpment API is an initial implementation of the OpenStack Compute API, v1.1, with custom extensions specific to the `Synnefo IaaS <http://synnefo.org/>`_ cloud management software. |
|
15 | 14 |
|
16 | 15 |
./kamaki is open source and released under a 2-clause BSD License. |
17 | 16 |
|
b/docs/usage.rst | ||
---|---|---|
689 | 689 |
|
690 | 690 |
[kamaki]:!ls -al |
691 | 691 |
total 16 |
692 |
drwxrwxr-x 2 saxtouri saxtouri 4096 Nov 27 16:47 .
|
|
693 |
drwxrwxr-x 7 saxtouri saxtouri 4096 Nov 27 16:47 ..
|
|
694 |
-rw-rw-r-- 1 saxtouri saxtouri 8063 Jun 28 14:48 kamaki-logo.png
|
|
692 |
drwxrwxr-x 2 username username 4096 Nov 27 16:47 .
|
|
693 |
drwxrwxr-x 7 username username 4096 Nov 27 16:47 ..
|
|
694 |
-rw-rw-r-- 1 username username 8063 Jun 28 14:48 kamaki-logo.png
|
|
695 | 695 |
|
696 | 696 |
[kamaki]:shell cp kamaki-logo.png logo-copy.png |
697 | 697 |
|
698 | 698 |
[kamaki]:shell ls -al |
699 | 699 |
total 24 |
700 |
drwxrwxr-x 2 saxtouri saxtouri 4096 Nov 27 16:47 .
|
|
701 |
drwxrwxr-x 7 saxtouri saxtouri 4096 Nov 27 16:47 ..
|
|
702 |
-rw-rw-r-- 1 saxtouri saxtouri 8063 Jun 28 14:48 kamaki-logo.png
|
|
703 |
-rw-rw-r-- 1 saxtouri saxtouri 8063 Jun 28 14:48 logo-copy.png
|
|
700 |
drwxrwxr-x 2 username username 4096 Nov 27 16:47 .
|
|
701 |
drwxrwxr-x 7 username username 4096 Nov 27 16:47 ..
|
|
702 |
-rw-rw-r-- 1 username username 8063 Jun 28 14:48 kamaki-logo.png
|
|
703 |
-rw-rw-r-- 1 username username 8063 Jun 28 14:48 logo-copy.png
|
|
704 | 704 |
|
705 | 705 |
|
706 | 706 |
Kamaki shell commits command strings to the outside shell and prints the results, without interacting with it. After a command is finished, kamaki shell returns to its initial state, which involves the current directory, as show in example 4.8.2 . |
b/kamaki/__init__.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
__version__ = '0.6.1' |
|
34 |
__version__ = '0.6.2' |
Also available in: Unified diff