Skip to content

Commit 2a8f128

Browse files
authored
Merge pull request #57 from rkratky/contrib-upd
CLI docs contrib guidance
2 parents 290b011 + 8fa1174 commit 2a8f128

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

docs/how-to/contribute-docs.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,77 @@ The following roles are especially useful:
146146
: Linux package name (this role is custom to this documentation project).
147147
148148
149+
### Command line and terminal output
150+
151+
Ubuntu Project documentation defaults to presenting command examples and terminal output in the following manner.
152+
153+
154+
#### Command examples
155+
156+
To show an example of a command entered on the command line, use:
157+
158+
* A regular literal block with language type `none` to prevent syntax highlighting.
159+
* Angled brackets (`<>`) to indicate a part to be substituted by the user.
160+
* Square brackets (`[]`) to indicate optional arguments.
161+
* Command split over multiple lines to avoid wrapping or the need to scroll.
162+
* Dollar (`$`) or hash (`#`) character to indicate normal user or superuser prompt respectively.
163+
164+
Example source for MyST:
165+
166+
````none
167+
```none
168+
$ command --option=<mandatory_value> [optional_parameter] && \
169+
another-command --option --option2
170+
```
171+
````
172+
173+
174+
#### Terminal output
175+
176+
When showing terminal output, use:
177+
178+
* Separate blocks for the invocation and output.
179+
* Suitably shortened output to show only relevant parts.
180+
181+
Example source for MyST:
182+
183+
````none
184+
To enable the example service, run:
185+
186+
```none
187+
$ examplectl start service
188+
```
189+
190+
The output indicates that the example service is now active:
191+
192+
```none
193+
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
194+
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
195+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
196+
nisi ut aliquip ex ea commodo consequat.
197+
198+
[...]
199+
```
200+
````
201+
202+
In case it is useful to show a command using a specific command-line prompt together with the output, use the `terminal` directive.
203+
204+
Example source for MyST:
205+
206+
````none
207+
Run the {command}`command` as the root user to achieve the folowing result:
208+
209+
```{terminal}
210+
:user: root
211+
:host: ubuntu
212+
:dir: /tmp
213+
:input: command --option
214+
215+
Lorem ipsum dolor sit amet, consectetur adipiscing elit
216+
```
217+
````
218+
219+
149220
## Testing the documentation
150221

151222
Test your changes before submitting a pull request. Run the following commands from within the `docs/` directory to test the documentation locally:

0 commit comments

Comments
 (0)