View Tutorial Metadata Edit Content Revision History Add to Watchlist Add New Tutorial Tutorialpedia Command Function

`command() Function

Pre-requisites

The Command function is part of the Tutorialpedia Tutorial Syntax, helping you edit content on Tutorialpedia: How to understand the Tutorialpedia Syntax

What is it for?

The `command() function is used to display command line instructions and/or command line output. It's intended to be used for a variety of environments, such as shell interfaces or REPL. For some of those environments, syntax highlighting is supported.

Example 1

Including a single line of command:

`command(environment:'linux')
  ls -la;

This will display:

ls -la;

Example 2

It's also possible to include more than one line, using the Escaping in CodePax tutorial syntax

`command(environment:'linux')
  {`
drwxr-xr-x   7 root root  4096 2009-07-14 09:54 .
drwxr-xr-x 148 root root 12288 2009-07-18 07:21 ..
-rw-r--r--   1 root root 10170 2009-04-14 17:18 apache2.conf
drwxr-xr-x   2 root root  4096 2009-07-14 09:54 conf.d
-rw-r--r--   1 root root   378 2008-06-25 15:49 envvars
-rw-r--r--   1 root root     0 2008-09-20 10:25 httpd.conf
drwxr-xr-x   2 root root 12288 2009-07-14 09:54 mods-available
drwxr-xr-x   2 root root  4096 2008-09-20 11:38 mods-enabled
  `}

This will display:

drwxr-xr-x   7 root root  4096 2009-07-14 09:54 .
drwxr-xr-x 148 root root 12288 2009-07-18 07:21 ..
-rw-r--r--   1 root root 10170 2009-04-14 17:18 apache2.conf
drwxr-xr-x   2 root root  4096 2009-07-14 09:54 conf.d
-rw-r--r--   1 root root   378 2008-06-25 15:49 envvars
-rw-r--r--   1 root root     0 2008-09-20 10:25 httpd.conf
drwxr-xr-x   2 root root 12288 2009-07-14 09:54 mods-available
drwxr-xr-x   2 root root  4096 2008-09-20 11:38 mods-enabled

Parameters

environment

Specifies the environment where this command can be executed. It must be lowercase. CodePax Command Function Supported Environments

nowrap

By default, the code is wrapped to 80 characters width. If the line is longer than 80 characters, a newline character is added before the last word. Sometimes you need to display code which is wider than 80 characters. In this case, add the following parameter to the `code() call:

nowrap:'1'

Only plain text supported.

Optional

Required - will be kept private

Optional

 
 

Rating: (0+, 0-) In: Tutorialpedia