Template:Cmd
From Gentoo Wiki
Revision as of 19:25, 17 July 2017 by Maffblaster (talk | contribs) (Enable the passing of collapse-output.)
[edit] Documentation
Note
This page is a template. It contains some standardized, often used text, which can be transcluded inside other pages. As this template is widely used in our wiki, it may be protected in which case only staff members can change it. Use the discussion page to propose enhancements or fixes, or to voice your opinion.
This page is a template. It contains some standardized, often used text, which can be transcluded inside other pages. As this template is widely used in our wiki, it may be protected in which case only staff members can change it. Use the discussion page to propose enhancements or fixes, or to voice your opinion.
Use this template to show a shell box with a user command.
Parameters
- Unnamed parameters (up to 10)
- Add commands. Use {{=}} or {{!}} instead of the characters "=" or "|" for equal or pipe symbols, respectively.
- prompt (optional)
- Change the command prompt (default:
user $). - color (optional)
- Change the prompt color (default:
#4E9A06green for text and#4169e1royalblue for the $ symbol).). - output (optional)
- Add the command's output.
- collapse-output (optional)
- Collapses the output so that it is only displayed when the "Expand" link is clicked (must be set to
trueto enable collapsed output).
Usage
See the template's testcases:
| Parameter: 1. unnamed | |
|---|---|
| Wiki code | {{Cmd|a command}}
|
| Main version | user $a command |
| Sandbox version | user $a command
|
| Parameter: unnamed with the special characters "=" and "|" | |
|---|---|
| Wiki code | {{Cmd|a command with {{=}} and {{!}}}}
|
| Main version | |
| Sandbox version |
|
| Parameter: output | |
|---|---|
| Wiki code | {{Cmd|a command|output=<pre>
Some output
</pre>}}
|
| Main version | user $a commandSome output |
| Sandbox version | user $a commandSome output
|
| Parameters: output, collapse-output | |
|---|---|
| Wiki code | {{Cmd
|ls -l /sys
|collapse-output=true
|output=<pre>
total 0
drwxr-xr-x 2 root root 0 Jun 28 14:42 block
drwxr-xr-x 30 root root 0 May 31 13:51 bus
drwxr-xr-x 68 root root 0 May 31 13:51 class
drwxr-xr-x 4 root root 0 May 31 13:51 dev
drwxr-xr-x 23 root root 0 May 31 13:51 devices
drwxr-xr-x 6 root root 0 May 31 13:51 firmware
drwxr-xr-x 14 root root 0 May 31 13:51 fs
drwxr-xr-x 11 root root 0 May 31 13:51 kernel
drwxr-xr-x 281 root root 0 May 31 13:51 module
drwxr-xr-x 2 root root 0 Jun 28 14:42 power
</pre>
}}
|
| Main version | user $ls -l /sys
total 0 drwxr-xr-x 2 root root 0 Jun 28 14:42 block drwxr-xr-x 30 root root 0 May 31 13:51 bus drwxr-xr-x 68 root root 0 May 31 13:51 class drwxr-xr-x 4 root root 0 May 31 13:51 dev drwxr-xr-x 23 root root 0 May 31 13:51 devices drwxr-xr-x 6 root root 0 May 31 13:51 firmware drwxr-xr-x 14 root root 0 May 31 13:51 fs drwxr-xr-x 11 root root 0 May 31 13:51 kernel drwxr-xr-x 281 root root 0 May 31 13:51 module drwxr-xr-x 2 root root 0 Jun 28 14:42 power |
| Sandbox version | user $ls -l /sys
total 0 drwxr-xr-x 2 root root 0 Jun 28 14:42 block drwxr-xr-x 30 root root 0 May 31 13:51 bus drwxr-xr-x 68 root root 0 May 31 13:51 class drwxr-xr-x 4 root root 0 May 31 13:51 dev drwxr-xr-x 23 root root 0 May 31 13:51 devices drwxr-xr-x 6 root root 0 May 31 13:51 firmware drwxr-xr-x 14 root root 0 May 31 13:51 fs drwxr-xr-x 11 root root 0 May 31 13:51 kernel drwxr-xr-x 281 root root 0 May 31 13:51 module drwxr-xr-x 2 root root 0 Jun 28 14:42 power
|
| Parameters: prompt, color | |
|---|---|
| Wiki code | {{Cmd
|a command
|prompt=example ?
|color=lightblue
}}
|
| Main version | example ?a command
|
| Sandbox version | example ?a command
|
| Parameter: unnamed (10x) | |
|---|---|
| Wiki code | {{Cmd
|1. command
|...
|10. command
}}
|
| Main version | user $1. command
user $2. command
user $3. command
user $4. command
user $5. command
user $6. command
user $7. command
user $8. command
user $9. command
user $10. command
|
| Sandbox version | user $1. command
user $2. command
user $3. command
user $4. command
user $5. command
user $6. command
user $7. command
user $8. command
user $9. command
user $10. command
|
See also
Note
The above documentation is transcluded from Template:Cmd/doc. (edit | history)
Editors can experiment in this template's sandbox (edit) and testcases (edit) pages.
Please add categories and interwikis to the /doc subpage. (See the subpages of this template.)
The above documentation is transcluded from Template:Cmd/doc. (edit | history)
Editors can experiment in this template's sandbox (edit) and testcases (edit) pages.
Please add categories and interwikis to the /doc subpage. (See the subpages of this template.)