The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "Help:Funtoo Editing Guidelines/ConsoleOutput"
(5 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
# ##i##bluetoothctl | # ##i##bluetoothctl | ||
[##g##NEW##!g##] Controller 00:02:72:C9:62:65 antec [default] | [##g##NEW##!g##] Controller 00:02:72:C9:62:65 antec [default] | ||
##bl##[bluetooth]##!bl### ##i##power on | \##bl##[bluetooth]##!bl### ##i##power on | ||
Changing power on succeeded | Changing power on succeeded | ||
##bl##[bluetooth]##!bl### ##i##agent on | \##bl##[bluetooth]##!bl### ##i##agent on | ||
Agent registered | Agent registered | ||
##bl##[bluetooth]##!bl### ##i##scan on | \##bl##[bluetooth]##!bl### ##i##scan on | ||
Discovery started | Discovery started | ||
##bl##[bluetooth]##!bl### ##i##devices | \##bl##[bluetooth]##!bl### ##i##devices | ||
Device 00:1F:20:3D:1E:75 Logitech K760 | Device 00:1F:20:3D:1E:75 Logitech K760 | ||
##bl##[bluetooth]##!bl### ##i##pair 00:1F:20:3D:1E:75 | \##bl##[bluetooth]##!bl### ##i##pair 00:1F:20:3D:1E:75 | ||
Attempting to pair with 00:1F:20:3D:1E:75 | Attempting to pair with 00:1F:20:3D:1E:75 | ||
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes | [##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes | ||
##r##[agent]##!r## Passkey: 454358 | \##r##[agent]##!r## Passkey: 454358 | ||
##r##[agent]##!r## Passkey: ##i##4##!i##54358 | \##r##[agent]##!r## Passkey: ##i##4##!i##54358 | ||
##r##[agent]##!r## Passkey: ##i##45##!i##4358 | \##r##[agent]##!r## Passkey: ##i##45##!i##4358 | ||
##r##[agent]##!r## Passkey: ##i##454##!i##358 | \##r##[agent]##!r## Passkey: ##i##454##!i##358 | ||
##r##[agent]##!r## Passkey: ##i##4543##!i##58 | \##r##[agent]##!r## Passkey: ##i##4543##!i##58 | ||
##r##[agent]##!r## Passkey: ##i##45435##!i##8 | \##r##[agent]##!r## Passkey: ##i##45435##!i##8 | ||
##r##[agent]##!r## Passkey: ##i##454358##!i## | \##r##[agent]##!r## Passkey: ##i##454358##!i## | ||
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Paired: yes | [##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Paired: yes | ||
Pairing successful | Pairing successful | ||
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: no | [##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: no | ||
##bl##[bluetooth]##!bl### ##i##connect 00:1F:20:3D:1E:75 | \##bl##[bluetooth]##!bl### ##i##connect 00:1F:20:3D:1E:75 | ||
Attempting to connect to 00:1F:20:3D:1E:75 | Attempting to connect to 00:1F:20:3D:1E:75 | ||
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes | [##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes | ||
Connection successful | Connection successful | ||
##bl##[bluetooth]##!bl### ##i##quit | \##bl##[bluetooth]##!bl### ##i##quit | ||
[##r##DEL##!r##] Controller 00:02:72:C9:62:65 antec [default] | [##r##DEL##!r##] Controller 00:02:72:C9:62:65 antec [default] | ||
# | # | ||
}} | }} | ||
As you can see, this renders in a way that provides a more realistic representation of what actually happened on a terminal console. The text highlighted in bright | As you can see, this renders in a way that provides a more realistic representation of what actually happened on a terminal console. The text highlighted in bright white is supposed to be the text that the user has typed in directly. | ||
=== Console Usage === | === Console Usage === | ||
Line 61: | Line 61: | ||
$ ##i##run a command as user | $ ##i##run a command as user | ||
}} | }} | ||
To specify a hostname in a prompt, do this: | |||
<pre> | |||
{{console|body= | |||
%my-hostname% ##i##run a command on a host | |||
}} | |||
</pre> | |||
Produces: | |||
{{console|body= | |||
%my-hostname% ##i##run a command on a host | |||
}} | |||
{{important|1= | {{important|1= | ||
Note that we use a | Note that we use a {{c|#}} prompt for {{c|root}}, a {{c|$}} prompt to denote a non-root user and {{c|%}} for a host name. If you need to disable the auto-expansion of an initial {{c|#}}, {{c|%}} or {{c|$}} to a prompt, start the line with a {{c|\}} (backslash) character.}} | ||
<pre> | |||
{{console|body= | |||
###i## cat > /usr/bin/helloworld.sh << "EOF" | |||
\#!/bin/bash | |||
\# Simple script comment | |||
echo hello world | |||
EOF | |||
}} | |||
</pre> | |||
Produces: | |||
{{console|body= | |||
###i## cat > /usr/bin/helloworld.sh << "EOF" | |||
\#!/bin/bash | |||
\# Simple script comment | |||
echo hello world | |||
EOF | |||
}} | |||
{{important|The <tt>##i##</tt> text tags the rest of the line as being ''user input'' ("i" is for "input"). It is then highlighted in a noticeable color so it stands out from text that is not typed in by the user.}} | {{important|The <tt>##i##</tt> text tags the rest of the line as being ''user input'' ("i" is for "input"). It is then highlighted in a noticeable color so it stands out from text that is not typed in by the user.}} | ||
If you need to end highlighting of user input prior to the end of a line, use | If you need to end highlighting of user input prior to the end of a line, use {{c|##!i##}} to mark the end of the highlighted area. | ||
The following special character sequences are also available: | The following special character sequences are also available: |
Latest revision as of 20:36, January 9, 2023
Daniel Robbins has developed a custom MediaWiki extension called ConsoleOutput
to realistically display console output on the wiki. Here's an example to give you an idea of what it can look like:
root # bluetoothctl [NEW] Controller 00:02:72:C9:62:65 antec [default] [bluetooth]# power on Changing power on succeeded [bluetooth]# agent on Agent registered [bluetooth]# scan on Discovery started [bluetooth]# devices Device 00:1F:20:3D:1E:75 Logitech K760 [bluetooth]# pair 00:1F:20:3D:1E:75 Attempting to pair with 00:1F:20:3D:1E:75 [CHG] Device 00:1F:20:3D:1E:75 Connected: yes [agent] Passkey: 454358 [agent] Passkey: 454358 [agent] Passkey: 454358 [agent] Passkey: 454358 [agent] Passkey: 454358 [agent] Passkey: 454358 [agent] Passkey: 454358 [CHG] Device 00:1F:20:3D:1E:75 Paired: yes Pairing successful [CHG] Device 00:1F:20:3D:1E:75 Connected: no [bluetooth]# connect 00:1F:20:3D:1E:75 Attempting to connect to 00:1F:20:3D:1E:75 [CHG] Device 00:1F:20:3D:1E:75 Connected: yes Connection successful [bluetooth]# quit [DEL] Controller 00:02:72:C9:62:65 antec [default] root #
As you can see, this renders in a way that provides a more realistic representation of what actually happened on a terminal console. The text highlighted in bright white is supposed to be the text that the user has typed in directly.
Console Usage
To display console output, use the {{console}} template:
For a root console:
{{console|body= ###i## run a command as root }}
Produces:
root # run a command as root
For a non-root console:
{{console|body= $ ##i##run a command as user }}
Produces:
user $ run a command as user
To specify a hostname in a prompt, do this:
{{console|body= %my-hostname% ##i##run a command on a host }}
Produces:
my-hostname # run a command on a host
Note that we use a #
prompt for root
, a $
prompt to denote a non-root user and %
for a host name. If you need to disable the auto-expansion of an initial #
, %
or $
to a prompt, start the line with a \
(backslash) character.
{{console|body= ###i## cat > /usr/bin/helloworld.sh << "EOF" \#!/bin/bash \# Simple script comment echo hello world EOF }}
Produces:
root # cat > /usr/bin/helloworld.sh << "EOF" #!/bin/bash # Simple script comment echo hello world EOF
The ##i## text tags the rest of the line as being user input ("i" is for "input"). It is then highlighted in a noticeable color so it stands out from text that is not typed in by the user.
If you need to end highlighting of user input prior to the end of a line, use ##!i##
to mark the end of the highlighted area.
The following special character sequences are also available:
##g##
- Green##y##
- Yellow##bl##
- Blue##r##
- Red##b##
- Bold
Please use the above coloring options sparingly. It is sometimes nice to use them to get wiki console output to match the colors that are displayed on a Linux console. Also note that for every color above, there is a matching ##!(colorcode)##
option to turn color off prior to end of line.