This document provides guidelines to follow while developing user-facing interfaces.
- Verify proper English is used.
- The first letter of the first word in each sentence of a help string should be in upper case.
- Unless there are acronyms, the rest of the words should be in lower case.
- No “.” (dot) at the end of the help string.
- Do not wrap lines; let the CLI infra do it uniformly.
- Specify units where applicable:
- KB is a kilobyte.
- Kb is a kilobit
- Mb is a megabit
- MB is a megabyte
- GB is a gigabyte
- Gb is a gigabit
- Time units should not be shortened; write "seconds" instead of "sec" or "s".
- The ps suffix is for “per second”. For example, Gbps stands for gigabit per second.
- The pps is a suffix for packets per second. For example, Gpps stands for giga packet per second.
- The word "packets" should not be shortened to anything like pkts.
- Add the “Default” description in the following form: - If it is a help message for a multiple choice configuration, mark the default choice as “(Default)”. For example, “IPv4 (Default)”. - If the help message describes a possible value, then add “(Defaut: default_value)”. For example, “Set hostname of the system (Default: switch)”.
- Make sure the ERR logs are really errors; move them to a lower level as appropriate.
- When adding a new command which uses an already existing token, use the macro of the existing token help string for the starting token. For example, all show commands use SHOW_STR macro as the help string for “show” token. If the first token does not have a macro, move the help string to the macro and use it in both places.
The above guidelines should be followed for contextual help strings as well.
- Make sure that singular/plural nouns are always correct. For example, no “5 minute” or “1 minutes”.
- Verify table alignments:
- Headings must be aligned to the margin (no space at the beginning).
- Subsequent lines must be aligned to the margin by a single space; one space must be added to each line.
- Subsequent lines after headings can have tabs to logically arrange the output.
- Different rows must be separated by a new line, not a blank line or “--------------------------------“.
- Headings must be separated from output body by “-----------------------------------------“.
- Do not include developer level debug information.
- Shortening time units is allowed. For example, “sec.”, “min.”, “hr.”, “wk.”, or “yr.”.
- The word packets may be shortened to “pkt.”/”pkts.”.
- Mind the dots at the end of acronyms.
- Use an 80 character limit for outputs.
- Units must be specified, preferably with the heading.
- Keep one blank line at the end of the display to visually separate the console prompt.
- For non-tabular outputs use a colon ":" to separate the column name from the value.
- Align colons ":" as much as possible. Otherwise, separate them into different groups and make it appealing.
- Do not use “+++++++++++++++++++” or “===================” for borders.
- If show command output involves the configuration of multiple instances, it should print sorted output in user readable format.
OpenSwitch leverages the VLOG capability of OpenVSwitch as its logging infrastructure. Following are the guidelines when introducing log messages into the OpenSwitch codebase:
- Do not use personal references. For example, do not use “I”, “me”, “you”, “he”, “she”, or “they”.
- Be short and precise.
- Use short intuitive phrases instead of complete sentences: “Wrong hostname” is better than “The hostname is wrong”.
- If it is a proper sentence, put a period “.” at the end.
- Use correct punctuation; commas, colons, semi-colons, etc.
- Shortening follows the rules of help messages.
- Do not use special characters like “!” or “?”.