Template:Get: Difference between revisions
Appearance
| [unchecked revision] | [unchecked revision] |
Content deleted Content added
Caleb Cooper (talk | contribs) No edit summary |
Caleb Cooper (talk | contribs) No edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{#ifexist:Cli:{{{1}}}| |
{{#ifexist:Cli:{{{1}}}| |
||
<div class="mw-collapsible {{#if:{{{open|}}}||mw-collapsed}} force-toggle-float-left" data-collapsetext="-" data-expandtext="+" style="overflow:hidden; display: inline;">[[Cli:{{{1}}}|<span style="color: blue; display: inline;" title="{{#lst:Cli:{{{1}}}|description}} {{#if:{{#lst:Cli:{{{1}}}|version}}|{{#ifeq:{{#lst:Cli:{{{1}}}|version}}|07.0x.0y||(ver. {{#lst:Cli:{{{1}}}|version}} )}}|}}">'''{{{alt-text|{{{2|{{{1}}}}}}}}}'''</span>]]<div class="mw-collapsible-content {{{color| |
<div class="mw-collapsible {{#if:{{{open|}}}||mw-collapsed}} force-toggle-float-left" data-collapsetext="-" data-expandtext="+" style="overflow:hidden; display: inline;">[[Cli:{{{1}}}|<span style="color: blue; display: inline;" title="{{#lst:Cli:{{{1}}}|description}} {{#if:{{#lst:Cli:{{{1}}}|version}}|{{#ifeq:{{#lst:Cli:{{{1}}}|version}}|07.0x.0y||(ver. {{#lst:Cli:{{{1}}}|version}} )}}|}}">'''{{{alt-text|{{{2|{{{1}}}}}}}}}'''</span>]]<div class="mw-collapsible-content {{{color|basic}}}" style="align: left;">{{{example|{{{3|{{#lst:Cli:{{{1}}}|{{{section|example}}}}}}}}}}}</div></div>{{#if:{{{inline|}}}||<br><br style="clear:both;">}} |
||
| |
| |
||
<div class="mw-collapsible {{#if:{{{open|}}}||mw-collapsed}} {{#if:{{{color|}}}|{{{color}}}}} force-toggle-float-left" data-collapsetext="-" data-expandtext="+" style="overflow:hidden; display: inline;"><span style="color: blue; display: inline;">'''{{{alt-text|{{{2|{{{1}}}}}}}}}'''</span><div class="mw-collapsible-content {{{color| |
<div class="mw-collapsible {{#if:{{{open|}}}||mw-collapsed}} {{#if:{{{color|}}}|{{{color}}}}} force-toggle-float-left" data-collapsetext="-" data-expandtext="+" style="overflow:hidden; display: inline;"><span style="color: blue; display: inline;">'''{{{alt-text|{{{2|{{{1}}}}}}}}}'''</span><div class="mw-collapsible-content {{{color|basic}}}" style="align: left;">{{{example|{{{3|<pre>Need an Example</pre>}}}}}}</div></div>{{#if:{{{inline|}}}||<br><br style="clear:both;">}} |
||
}}<noinclude> |
}}<noinclude> |
||
| Line 122: | Line 122: | ||
</pre>}} |
</pre>}} |
||
|} |
|} |
||
{{Caution|In order to format commands like the example below, with no additional line breaks, it is necessary to enclose the commands in a table or div, this page is a good example [[compiki:common commands]]}} |
|||
| Line 148: | Line 152: | ||
|- |
|- |
||
|{{Get|Command show|open=1|color=basic}} |
|{{Get|Command show|open=1|color=basic}} |
||
|} |
|||
{| class="wikitable" |
|||
|Open=1 using syntaxhighlight and recoloring: |
|||
|- |
|||
|<pre>{{Get|Command show|open=1|color=blue-white|example= |
|||
<syntaxhighlight lang="text" highlight="4"> |
|||
cli> dns show |
|||
# | id | addresses |
|||
----+------+------------- |
|||
1 | DNS1 | 10.24.27.42 |
|||
| | 10.24.27.41 |
|||
</syntaxhighlight>}}</pre> |
|||
|- |
|||
|{{Get|Command show|color=blue-white|open=1|example= |
|||
<syntaxhighlight lang="text" highlight="4"> |
|||
cli> dns show |
|||
# | id | addresses |
|||
----+------+------------- |
|||
1 | DNS1 | 10.24.27.42 |
|||
| | 10.24.27.41 |
|||
cli> |
|||
</syntaxhighlight>}} |
|||
|} |
|} |
||
Latest revision as of 17:21, 5 May 2020
Usage
It is not necessary (but expected) when using this template that a page exists detailing the commands usage, it is from this page that the example and tool tip is taken, for the purpose of the examples below a test page has been created: Cli:Command show
| Only Specify the Command: |
{{Get|Command show}}
|
| Provide a different example : |
{{Get|Command show|example=
<pre>
cli> dns show
# | id | addresses
----+------+-------------
1 | DNS1 | 10.24.27.42
| | 10.24.27.41
</pre>}}
|
| Provide a different example, this time using syntaxhighlight and recoloring: |
{{Get|Command show|color=black-white|example=
<syntaxhighlight lang="text" highlight="4">
cli> dns show
# | id | addresses
----+------+-------------
1 | DNS1 | 10.24.27.42
| | 10.24.27.41
</syntaxhighlight>}}
|
Tip:
The tool tips for version and description are take from the page in the Cli namespace having the same name as the command, you can spot them between tags like this:
<section begin=version />1.0.0.179<section end=version /> and this:
<section begin=description />Description Goes Here!<section end=description />
| Specify alternative section of page to pull example from: |
{{Get|Command show|section=hosts}}
|
| Show alternative Text: |
{{Get|command show|volume show|color=blue-white}}
|
| Show alternative Text and specify code example, no need to use "example=" if the example is the 3rd paramater: |
{{Get|command show|appliance show|
<pre>
cli> appliance show
# | id | name | service_tag | model | software_installed.release_version
----+----+-----------------------+-------------+------------------+------------------------------------
1 | A1 | PowerThor-appliance-1 | 59P42W2 | PowerStore 3000X | 1.0.0.1.3.720
cli> cluster show
# | name | management_address | storage_discovery_address | master_appliance_id | appliance_count | state
----+-----------+--------------------+---------------------------+---------------------+-----------------+------------
1 | PowerThor | 10.24.31.10 | 172.28.45.17 | A1 | 1 | Configured
cli>
</pre>}}
|
Caution:
In order to format commands like the example below, with no additional line breaks, it is necessary to enclose the commands in a table or div, this page is a good example compiki:common commands
| Display several commands without additional line breaks: |
{{Get|command show|command one|<pre>command one sample code</pre>|inline=1}}<br>{{Get|command show|command one|<pre>command two sample code</pre>|inline=1}}<br>{{Get|command show|command one|<pre>command three sample code</pre>|inline=1}}<br> |
|
|
The boilerplate page for documenting commands uses black and green coloring for the pre-formatted text, this can be set back to defaults by setting the color to basic like below
| Change color and display open: |
{{Get|Command show|open=1|color=basic}}
|
| Open=1 using syntaxhighlight and recoloring: |
{{Get|Command show|open=1|color=blue-white|example=
<syntaxhighlight lang="text" highlight="4">
cli> dns show
# | id | addresses
----+------+-------------
1 | DNS1 | 10.24.27.42
| | 10.24.27.41
</syntaxhighlight>}}
|
Show a Command with a collapsed div containing an example
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Command Name | 1 | Command Name, will like match page name describing this command
| String | required |
| Alternative Command Description | alt-text | Either Alternate Description of Command or an Example
| String | optional |
| Sample output | example | An example output of runing this command
| String | optional |
| Pre Color | color | Color of Pre-formatted Example
| String | optional |
| Name of page section | Section | Name of page section where pre-formatted example is found
| String | optional |
| Open | open | Shows pre-formatted example as open by default
| Boolean | optional |
| Inline | inline | Removes all new lines / carraige returns
| Boolean | optional |