root / docs / usage.rst @ bbd7762c
History | View | Annotate | Download (20.9 kB)
1 |
Usage |
---|---|
2 |
===== |
3 |
|
4 |
Kamaki features commands of the form:: |
5 |
|
6 |
[kamaki] <object> <action> [identifier(s)] <non-positional arguments> |
7 |
e.g., |
8 |
kamaki user info --username=user@example.com |
9 |
|
10 |
A detailed list of the command specifications can be found in |
11 |
`Commands <commands.html>`_ section. |
12 |
|
13 |
All commands can run either from the host shell or through the kamaki |
14 |
interactive shell: |
15 |
|
16 |
.. code-block:: console |
17 |
|
18 |
# Run from host shell |
19 |
$ kamaki user info |
20 |
... RESULTS ... |
21 |
|
22 |
# Run from kamaki interactive shell |
23 |
$ kamaki-shell |
24 |
[kamaki]: user info |
25 |
... RESULTS ... |
26 |
|
27 |
In the later, the term "one-command" will be user to refer to running kamaki |
28 |
commands from host shell, while the term "shell" will refer to the kamaki's own |
29 |
interactive shell |
30 |
|
31 |
.. note:: This section refers to the kamaki CLI. Developers and people who write |
32 |
scripts, should rather use the the |
33 |
`Clients lib <developers/code.html#the-clients-api>`_ instead of the kamaki |
34 |
CLI. |
35 |
|
36 |
Quick Setup |
37 |
----------- |
38 |
|
39 |
Kamaki interfaces rely on a list of configuration options. Check the |
40 |
`Setup <setup.html>`_ guide for a full list. |
41 |
|
42 |
As rule of the thump, it is enough to set a cloud authentication URL and TOKEN: |
43 |
|
44 |
.. code-block:: console |
45 |
:emphasize-lines: 1 |
46 |
|
47 |
Example 1.1: Set authentication URL, user token for cloud alias "default" |
48 |
|
49 |
$ kamaki config set cloud.default.url <authentication URL> |
50 |
$ kamaki config set cloud.default.token myt0k3n== |
51 |
|
52 |
.. note:: The term *default* can be replaced by any arbitary term chosen by |
53 |
the user. |
54 |
|
55 |
Shell vs one-command |
56 |
-------------------- |
57 |
|
58 |
Kamaki users can access Synnefo services through either the kamaki shell or the |
59 |
one-command interface. Both systems feature identical responses and error |
60 |
messages, since they rely on the same internal command and library API |
61 |
implementation. However, there are some minor differences. |
62 |
|
63 |
In favor of interactive shell: |
64 |
|
65 |
* shorter commands (context switching) |
66 |
* tab completion for commands (if supported by host shell) |
67 |
* kamaki-specific history with ↑ or ↓ keys (if supported by host shell) |
68 |
* re-run old commands with /history |
69 |
|
70 |
In favor of one-command: |
71 |
|
72 |
* users take advantage of host shell features (pipelines, redirection, etc.) |
73 |
* can be used in shell scripts |
74 |
|
75 |
Run as shell |
76 |
^^^^^^^^^^^^ |
77 |
To use kamaki as a shell, run: |
78 |
|
79 |
.. code-block:: console |
80 |
:emphasize-lines: 1 |
81 |
|
82 |
Example 2.2.1: Run kamaki shell |
83 |
|
84 |
$ kamaki-shell |
85 |
|
86 |
* with any kind of '-' prefixed arguments, except '-h', '--help', '-V', |
87 |
'- - version'. |
88 |
|
89 |
.. code-block:: console |
90 |
:emphasize-lines: 1 |
91 |
|
92 |
Example 2.2.2: Run kamaki shell with custom configuration file |
93 |
|
94 |
$ kamaki-shell -c myconfig.file |
95 |
|
96 |
Example 2.2.3: Run kamaki shell so as to use a specific cloud |
97 |
|
98 |
$ kamaki-shell --cloud=my_demo_cloud |
99 |
|
100 |
Example 2.2.4: Run kamaki shell with verbosity (shows HTTP requests) |
101 |
|
102 |
$ kamaki-shell -v |
103 |
|
104 |
.. note:: Valid arguments can be combined e.g., it is ok to run a shell with |
105 |
verbosity and a specific cloud:: |
106 |
|
107 |
$ kamaki-shell -v --cloud=my_demo_cloud |
108 |
|
109 |
Run as one-command |
110 |
^^^^^^^^^^^^^^^^^^ |
111 |
To use kamaki as an one-command tool, run: |
112 |
|
113 |
* with the '-h' or '--help' arguments (help for kamaki one-command) |
114 |
|
115 |
.. code-block:: console |
116 |
:emphasize-lines: 1 |
117 |
|
118 |
Example 2.3.1: Kamaki help |
119 |
|
120 |
$kamaki -h |
121 |
|
122 |
* with one or more command parameters (object and, maybe, action): |
123 |
|
124 |
.. code-block:: console |
125 |
:emphasize-lines: 1 |
126 |
|
127 |
Example 2.3.2: List servers managed by user |
128 |
|
129 |
$ kamaki server list |
130 |
|
131 |
One-command interface |
132 |
--------------------- |
133 |
|
134 |
Using help |
135 |
^^^^^^^^^^ |
136 |
|
137 |
Kamaki help provides information on commands (description, syntax). |
138 |
|
139 |
To see the command groups (objects), use -h or --help (example 1.3.1). The |
140 |
following examples demonstrate the help messages of kamaki, in the context of a |
141 |
command group (server) and of a command in that group (list). |
142 |
|
143 |
.. code-block:: console |
144 |
:emphasize-lines: 1 |
145 |
|
146 |
Example 3.1.1: kamaki help shows available parameters and command groups |
147 |
|
148 |
|
149 |
$ kamaki -h |
150 |
usage: kamaki <cmd_group> [<cmd_subbroup> ...] <cmd> |
151 |
[-v] [-s] [-V] [-d] [-c CONFIG] [-o OPTIONS] [--cloud CLOUD] [-h] |
152 |
|
153 |
optional arguments: |
154 |
-v, --verbose More info at response |
155 |
-s, --silent Do not output anything |
156 |
-V, --version Print current version |
157 |
-d, --debug Include debug output |
158 |
-c CONFIG, --config CONFIG |
159 |
Path to configuration file |
160 |
-o OPTIONS, --options OPTIONS |
161 |
Override a config value |
162 |
--cloud CLOUD Chose a cloud to connect to |
163 |
-h, --help Show help message |
164 |
|
165 |
Options: |
166 |
- - - - |
167 |
resource: Astakos/Account API commands for resources |
168 |
group: Pithos+/Storage user groups |
169 |
network: Networking API network commands |
170 |
subnet: Networking API network commands |
171 |
ip: Networking API floatingip commands |
172 |
image: Cyclades/Plankton API image commands |
173 |
imagecompute: Cyclades/Compute API image commands |
174 |
quota: Astakos/Account API commands for quotas |
175 |
sharer: Pithos+/Storage sharers |
176 |
project: Astakos project API commands |
177 |
user: Astakos/Identity API commands |
178 |
file: Pithos+/Storage object level API commands |
179 |
container: Pithos+/Storage container level API commands |
180 |
flavor: Cyclades/Compute API flavor commands |
181 |
server: Cyclades/Compute API server commands |
182 |
config: Kamaki configurations |
183 |
port: Networking API network commands |
184 |
history: Kamaki command history |
185 |
kamaki-shell: An interactive command line shell |
186 |
|
187 |
.. code-block:: console |
188 |
:emphasize-lines: 1,2 |
189 |
|
190 |
Example 3.1.2: Cyclades help contains all first-level commands of Cyclades |
191 |
command group |
192 |
|
193 |
$ kamaki server -h |
194 |
usage: kamaki server <...> [-v] [-s] [-V] [-d] [-c CONFIG] |
195 |
[-o OPTIONS] [--cloud CLOUD] [-h] |
196 |
|
197 |
optional arguments: |
198 |
-v, --verbose More info at response |
199 |
-s, --silent Do not output anything |
200 |
-V, --version Print current version |
201 |
-d, --debug Include debug output |
202 |
-c CONFIG, --config CONFIG |
203 |
Path to configuration file |
204 |
-o OPTIONS, --options OPTIONS |
205 |
Override a config value |
206 |
--cloud CLOUD Chose a cloud to connect to |
207 |
-h, --help Show help message |
208 |
|
209 |
Options: |
210 |
- - - - |
211 |
info: Detailed information on a Virtual Machine |
212 |
modify: Modify attributes of a virtual server |
213 |
create: Create a server (aka Virtual Machine) |
214 |
list: List virtual servers accessible by user |
215 |
reboot: Reboot a virtual server |
216 |
start: Start an existing virtual server |
217 |
shutdown: Shutdown an active virtual server |
218 |
delete: Delete a virtual server |
219 |
|
220 |
.. code-block:: console |
221 |
:emphasize-lines: 1,2 |
222 |
|
223 |
Example 3.1.3: Help for command "server list" with syntax, description and |
224 |
available user options |
225 |
|
226 |
$ kamaki server list -h |
227 |
usage: kamaki server list [-v] [-s] [-V] [-d] [-c CONFIG] [-o OPTIONS] |
228 |
[--cloud CLOUD] [-h] [--since SINCE] [--enumerate] |
229 |
[-l] [--more] [-n LIMIT] [-j] |
230 |
|
231 |
List Virtual Machines accessible by user |
232 |
|
233 |
optional arguments: |
234 |
-v, --verbose More info at response |
235 |
-s, --silent Do not output anything |
236 |
-V, --version Print current version |
237 |
-d, --debug Include debug output |
238 |
-c CONFIG, --config CONFIG |
239 |
Path to config file |
240 |
-o OPTIONS, --options OPTIONS |
241 |
Override a config value |
242 |
--cloud CLOUD Chose a cloud to connect to |
243 |
-h, --help Show help message |
244 |
--status STATUS filter by status (ACTIVE, STOPPED, REBOOT, ERROR, |
245 |
etc.) |
246 |
--enumerate Enumerate results |
247 |
--name-suffix NAME_SUFF |
248 |
filter by name suffix (case insensitive) |
249 |
--image-id IMAGE_ID filter by image id |
250 |
--metadata META filter by metadata key=values |
251 |
-j, --json show headers in json |
252 |
--id ID filter by id |
253 |
--user-id USER_ID filter by user id |
254 |
--id-like ID_LIKE print only if id contains this (case insensitive) |
255 |
--id-suffix ID_SUFF filter by id suffix (case insensitive) |
256 |
--since SINCE show only items since date (' d/m/Y H:M:S ') |
257 |
-l, --details show detailed output |
258 |
--name NAME filter by name |
259 |
--more output results in pages (-n to set items per page, |
260 |
default 10) |
261 |
--name-prefix NAME_PREF |
262 |
filter by name prefix (case insensitive) |
263 |
-n LIMIT, --number LIMIT |
264 |
limit number of listed virtual servers |
265 |
--id-prefix ID_PREF filter by id prefix (case insensitive) |
266 |
--user-name USER_NAME |
267 |
filter by user name |
268 |
--name-like NAME_LIKE |
269 |
print only if name contains this (case insensitive) |
270 |
--metadata-like META_LIKE |
271 |
print only if in key=value, the value is part of |
272 |
actual value |
273 |
--flavor-id FLAVOR_ID |
274 |
filter by flavor id |
275 |
|
276 |
Details: |
277 |
Use filtering arguments (e.g., --name-like) to manage long server lists |
278 |
|
279 |
.. _using-history-ref: |
280 |
|
281 |
Using history |
282 |
^^^^^^^^^^^^^ |
283 |
|
284 |
Kamaki command history is stored in '${HOME}/.kamaki.history' by default). To |
285 |
set a custom history file path users must set the history.file config option |
286 |
(more on config options `here <setup.html#editing-options>`_). |
287 |
|
288 |
Every command is appended at the end of that file. In order to see how to use |
289 |
history, use the kamaki help system: |
290 |
|
291 |
.. code-block:: console |
292 |
:emphasize-lines: 1 |
293 |
|
294 |
Example 3.2.1: Available history options |
295 |
|
296 |
$ kamaki history -h |
297 |
Options: |
298 |
- - - - |
299 |
clean: Clean up history (permanent) |
300 |
show : Show intersession command history |
301 |
|
302 |
|
303 |
Example 3.2.2: Clean up everything, run a kamaki command, show full and filtered history |
304 |
|
305 |
$ kamaki history clean |
306 |
$ kamaki server list |
307 |
... |
308 |
$ kamaki history show |
309 |
1. kamaki server list |
310 |
2. kamaki history show |
311 |
$ kamaki history show --match server |
312 |
1. kamaki server list |
313 |
3. kamaki history show --match server |
314 |
|
315 |
Debug and logging |
316 |
^^^^^^^^^^^^^^^^^ |
317 |
|
318 |
Debug |
319 |
""""" |
320 |
|
321 |
When in debug mode, kamaki outputs some useful debug information (stack trace |
322 |
and http logs). Kamaki in debug mode cancels the suppression of warning |
323 |
messages too. |
324 |
|
325 |
To run kamaki in debug mode use the -d or --debug option. |
326 |
|
327 |
|
328 |
Verbose |
329 |
""""""" |
330 |
|
331 |
Most kamaki commands are translated into http requests. Kamaki clients API |
332 |
translates command semantics to REST and handles the response. Users who need |
333 |
to have access to these commands can use the verbose mode that outputs the |
334 |
HTTP Request and Response details along with the (possibly modified) regular |
335 |
command output. |
336 |
|
337 |
To run kamaki in verbose mode use the *-v/- - verbose* argument, it goes with |
338 |
everything. |
339 |
|
340 |
Verbose mode outputs the request and response mode, address and |
341 |
headers as well as the size of the data block, if any. Sensitive information |
342 |
(x-auth-token header and data body) are omitted by default,. Users who need |
343 |
this information may enable it through the log_token and log_data configuration |
344 |
options |
345 |
|
346 |
.. tip:: Use the -o argument to include http data in the output: |
347 |
|
348 |
.. code-block:: console |
349 |
|
350 |
$ kamaki server list -v -o log_data=on |
351 |
|
352 |
|
353 |
Logging |
354 |
""""""" |
355 |
|
356 |
Kamaki logs in a file specified by the *log_file* option which defaults to |
357 |
*${HOME}/.kamaki.log*. This configuration option can be modified:: |
358 |
|
359 |
kamaki config set log_file /new/log/file/path |
360 |
|
361 |
Kamaki logs http request and response information, namely the method, URL, |
362 |
headers and data size. Sensitive information (data and token header) are |
363 |
omitted by default. There are some configuration options that can switch them |
364 |
on, though: |
365 |
|
366 |
* HTTP data blocks are not logged by default |
367 |
to enable logging the full http bodies, set log_data to `on`:: |
368 |
|
369 |
kamaki config set log_data on |
370 |
|
371 |
to disable it, set it to `off`:: |
372 |
|
373 |
kamaki config set log_data off |
374 |
|
375 |
or delete it:: |
376 |
|
377 |
kamaki config delete log_data |
378 |
|
379 |
* X-Auth-Token header is not logged by default |
380 |
to enable logging the X-Auth-Token header, set log_token to `on`:: |
381 |
|
382 |
kamaki config set log_token on |
383 |
|
384 |
to disable it, set it to `off`:: |
385 |
|
386 |
kamaki config set log_token off |
387 |
|
388 |
or delete it:: |
389 |
|
390 |
kamaki config delete log_token |
391 |
|
392 |
* The information (pid, name, date) of the processes that handle http requests |
393 |
is not logged by default, because if they are, logs are difficult to read. |
394 |
Still, they are useful for resolving race condition problems, so to enable |
395 |
logging proccess information:: |
396 |
|
397 |
kamaki config set log_pid on |
398 |
|
399 |
to disable it, set if to off:: |
400 |
|
401 |
kamaki config set log_pid off |
402 |
|
403 |
or delete it:: |
404 |
|
405 |
kamaki config delete log_pid |
406 |
|
407 |
One-command features |
408 |
^^^^^^^^^^^^^^^^^^^^ |
409 |
|
410 |
.. code-block:: console |
411 |
:emphasize-lines: 1 |
412 |
|
413 |
Example 3.4.1: List the trash container contents, containing c1_ |
414 |
|
415 |
$ kamaki file list -v -o log_token=on |
416 |
... |
417 |
X-Auth-Token: s0m3-3x4mp1e-70k3n |
418 |
... |
419 |
|
420 |
The -o argument can be used to temporarily override various (set or unset) |
421 |
options. In one command, all -o option sets are forgotten just after the |
422 |
command has been completed, and the previous settings are restored (the |
423 |
configuration file is not modified). |
424 |
|
425 |
For security reasons, all commands hide the authentication token from outputs |
426 |
and the logs. In example 3.4.1 the token is not hided, because of the |
427 |
*log_token=on* config option. |
428 |
|
429 |
.. warning:: Complimentary output i.e., http logs and informative messages are |
430 |
printed to standard error stream |
431 |
|
432 |
Interactive shell |
433 |
----------------- |
434 |
|
435 |
Command Contexts |
436 |
^^^^^^^^^^^^^^^^ |
437 |
|
438 |
The command namespaces in kamaki interactive shell are called **contexts**. |
439 |
|
440 |
Each command group is also a context where the users can **enter** by typing |
441 |
the group name. If the context switch is successful, the kamaki shell prompt |
442 |
changes to present the new context ("*file*" in example 4.1.1). |
443 |
|
444 |
.. code-block:: console |
445 |
:emphasize-lines: 1 |
446 |
|
447 |
Example 4.1.1: Start kamaki and switch to file context |
448 |
|
449 |
|
450 |
$ kamaki |
451 |
[kamaki]: file |
452 |
[file]: |
453 |
|
454 |
Type **exit** (alternatively **ctrl-D** in (X)nix systems or **ctrl-Z** in |
455 |
Windows) to exit a context and return to the context of origin. If already at |
456 |
the top context (kamaki), an exit is equivalent to exiting the program. |
457 |
|
458 |
.. code-block:: console |
459 |
:emphasize-lines: 1 |
460 |
|
461 |
Example 4.1.2: Exit file context and then exit kamaki |
462 |
|
463 |
[file]: exit |
464 |
[kamaki]: exit |
465 |
$ |
466 |
|
467 |
A user might **browse** through different contexts during one session. |
468 |
|
469 |
.. code-block:: console |
470 |
:emphasize-lines: 1 |
471 |
|
472 |
Example 4.1.3: Execute list command in different contexts |
473 |
|
474 |
$ kamaki |
475 |
[kamaki]: config |
476 |
[config]: list |
477 |
... (configuration options listing) ... |
478 |
[config]: exit |
479 |
[kamaki]: file |
480 |
[file]: list |
481 |
... (file listing) ... |
482 |
[file]: exit |
483 |
[kamaki]: server |
484 |
[server]: list |
485 |
... (servers listing) ... |
486 |
[server]: exit |
487 |
[kamaki]: |
488 |
|
489 |
Users can avoid switching between contexts: all commands can run from the |
490 |
**top context** e.g., examples 4.1.3 and 4.1.4 are equivalent. |
491 |
|
492 |
.. code-block:: console |
493 |
:emphasize-lines: 1 |
494 |
|
495 |
Example 4.1.4: Execute different "list" commands from top context |
496 |
|
497 |
[kamaki]: config list |
498 |
... (configuration options listing) ... |
499 |
[kamaki]: file list |
500 |
... (file listing) ... |
501 |
[kamaki]: server list |
502 |
... (servers listing) ... |
503 |
[kamaki]: |
504 |
|
505 |
While in a context, other contexts are accessible by using a **/** as shown in |
506 |
the following example: |
507 |
|
508 |
.. code-block:: console |
509 |
|
510 |
Example 4.1.5: Execute different "list" commands from the config context |
511 |
|
512 |
[kamaki]: config |
513 |
[config]: list |
514 |
... (configuration option listing) ... |
515 |
[config]: /file list |
516 |
... (file listing) ... |
517 |
[config]: /server list |
518 |
... (servers listing) ... |
519 |
[config]: |
520 |
|
521 |
Using Help |
522 |
^^^^^^^^^^ |
523 |
|
524 |
There are two help mechanisms: a context-level and a command-level. |
525 |
|
526 |
**Context-level help** lists the available commands in a context and can also |
527 |
offer a short description for each command. |
528 |
|
529 |
Context-level help syntax:: |
530 |
|
531 |
* Show available commands in current context * |
532 |
[context]: help |
533 |
... |
534 |
[context]: ? |
535 |
... |
536 |
|
537 |
* Show help for command cmd * |
538 |
[context]: help cmd |
539 |
... |
540 |
[context]: ?cmd |
541 |
... |
542 |
|
543 |
The context-level help results may change from context to context |
544 |
|
545 |
.. code-block:: console |
546 |
:emphasize-lines: 1 |
547 |
|
548 |
Example 4.2.1: Get available commands and then get help in a context |
549 |
|
550 |
[kamaki]: help |
551 |
|
552 |
kamaki commands: |
553 |
================ |
554 |
user config flavor history image network server file ... |
555 |
|
556 |
interactive shell commands: |
557 |
=========================== |
558 |
exit help shell |
559 |
|
560 |
[kamaki]: ?config |
561 |
Configuration commands (config -h for more options) |
562 |
|
563 |
[kamaki]: config |
564 |
|
565 |
[config]: ? |
566 |
|
567 |
config commands: |
568 |
================ |
569 |
delete get list set |
570 |
|
571 |
interactive shell commands: |
572 |
=========================== |
573 |
exit help shell |
574 |
|
575 |
[config]: help set |
576 |
Set a configuration option (set -h for more options) |
577 |
|
578 |
In context-level, there is a distinction between kamaki-commands and |
579 |
interactive shell commands. The former are available in one-command mode and |
580 |
are the main functionality of kamaki, while the later are used to manage the |
581 |
kamaki-shell. |
582 |
|
583 |
**Command-level help** prints the syntax, arguments and description of a |
584 |
specific (terminal) command |
585 |
|
586 |
Command-level help syntax:: |
587 |
|
588 |
* Get help for command cmd1 cmd2 ... cmdN * |
589 |
[context]: cmd1 cmd2 ... cmdN -h |
590 |
<syntax> |
591 |
|
592 |
<description> |
593 |
|
594 |
<arguments and possible extensions> |
595 |
|
596 |
Command-level help mechanism is exactly the same as the one used in |
597 |
one-command mode. For example, it is invoked by using the -h or --help |
598 |
parameter at any point. |
599 |
|
600 |
.. code-block:: console |
601 |
:emphasize-lines: 1 |
602 |
|
603 |
Example 4.2.2: Get command-level help for config and config-set |
604 |
|
605 |
|
606 |
[kamaki]: config --help |
607 |
config: Configuration commands |
608 |
delete: Delete a configuration option (and use the default value) |
609 |
get : Show a configuration option |
610 |
list : List configuration options |
611 |
set : Set a configuration option |
612 |
|
613 |
[kamaki]: config |
614 |
|
615 |
[config]: set -h |
616 |
usage: set <option> <value> [-v] [-d] [-h] [-i] [--config CONFIG] [-s] |
617 |
|
618 |
Set a configuration option |
619 |
|
620 |
optional arguments: |
621 |
-v, --verbose More info at response |
622 |
-d, --debug Include debug output |
623 |
-h, --help Show help message |
624 |
-i, --include Include protocol headers in the output |
625 |
--config CONFIG Path to configuration file |
626 |
-s, --silent Do not output anything |
627 |
|
628 |
There are many ways of producing a help message, as shown in example 4.2.3 |
629 |
|
630 |
.. code-block:: console |
631 |
:emphasize-lines: 1 |
632 |
|
633 |
Example 4.2.3: Equivalent calls of command-level help for config-set |
634 |
|
635 |
|
636 |
[config]: set -h |
637 |
[config]: set --help |
638 |
[kamaki]: config set -h |
639 |
[kamaki]: config set --help |
640 |
[file]: /config set -h |
641 |
[server]: /config set --help |
642 |
|
643 |
History modes |
644 |
^^^^^^^^^^^^^ |
645 |
|
646 |
There are two history modes: session and permanent. Session history keeps |
647 |
record of all actions in a kamaki shell session, while permanent history |
648 |
appends all commands to an accessible history file. |
649 |
|
650 |
Session history is only available in interactive shell mode. Users can iterate |
651 |
through past commands in the same session with the ↑ and ↓ keys. Session |
652 |
history is not stored, although commands are recorded through the permanent |
653 |
history mechanism. |
654 |
|
655 |
Permanent history is implemented as a command group and is common to both the |
656 |
one-command and shell interfaces. In specific, every command is appended in a |
657 |
history file (configured as `history_file` in settings, see |
658 |
`setup section <setup.html>`_ for details). Commands executed in one-command |
659 |
mode are mixed with the ones run in kamaki shell (also see |
660 |
:ref:`using-history-ref` section on this guide). |
661 |
|
662 |
OS Shell integration |
663 |
^^^^^^^^^^^^^^^^^^^^ |
664 |
|
665 |
Kamaki shell features the ability to execute OS-shell commands from any |
666 |
context. This can be achieved by typing *!* or *shell*:: |
667 |
|
668 |
[kamaki_context]: !<OS shell command> |
669 |
... OS shell command output ... |
670 |
|
671 |
[kamaki_context]: shell <OS shell command> |
672 |
... OS shell command output ... |
673 |
|
674 |
.. code-block:: console |
675 |
:emphasize-lines: 1 |
676 |
|
677 |
Example 4.7.1: Run unix-style shell commands from kamaki shell |
678 |
|
679 |
|
680 |
[kamaki]: !ls -al |
681 |
total 16 |
682 |
drwxrwxr-x 2 username username 4096 Nov 27 16:47 . |
683 |
drwxrwxr-x 7 username username 4096 Nov 27 16:47 .. |
684 |
-rw-rw-r-- 1 username username 8063 Jun 28 14:48 kamaki-logo.png |
685 |
|
686 |
[kamaki]: shell cp kamaki-logo.png logo-copy.png |
687 |
|
688 |
[kamaki]: shell ls -al |
689 |
total 24 |
690 |
drwxrwxr-x 2 username username 4096 Nov 27 16:47 . |
691 |
drwxrwxr-x 7 username username 4096 Nov 27 16:47 .. |
692 |
-rw-rw-r-- 1 username username 8063 Jun 28 14:48 kamaki-logo.png |
693 |
-rw-rw-r-- 1 username username 8063 Jun 28 14:48 logo-copy.png |
694 |
|
695 |
|
696 |
Kamaki shell commits command strings to the outside shell and prints the |
697 |
results, without interacting with it. After a command is finished, kamaki shell |
698 |
returns to its initial state, which involves the current directory, as shown in |
699 |
example 4.8.2 |
700 |
|
701 |
.. code-block:: console |
702 |
:emphasize-lines: 1 |
703 |
|
704 |
Example 4.8.2: Attempt (and fail) to change working directory |
705 |
|
706 |
|
707 |
[kamaki]: !pwd |
708 |
/home/username |
709 |
|
710 |
[kamaki]: !cd .. |
711 |
|
712 |
[kamaki]: shell pwd |
713 |
/home/username |