Skip to content

Commit 506ad1f

Browse files
#901 updated readme
1 parent ac68b5e commit 506ad1f

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,9 @@ func NewActionNameCommand(sl *metadata.SoftlayerCommand) *ActionNameCommand {
344344
Use: "command-name",
345345
Short: T("A description of the command"),
346346
Long: T(`This is an optional field, you can remove it if the command is simple.
347-
Otherwise create a nice long description of how to use this command. Its good to add some examples.
348-
349-
EXAMPLE:
350-
${COMMAND_NAME} sl newcommand command-name --someFlag test --soomethingElse
351-
This sets a flag and does something else.`)
347+
Otherwise create a nice long description of how to use this command. Its good to add some examples.`),
348+
Example: fmt.Sprintf(`${COMMAND_NAME} sl newcommand command-name --someFlag test --soomethingElse
349+
%s`, T(`This sets a flag and does something else.`)),
352350
Args: metadata.NoArgs,
353351
RunE: func(cmd *cobra.Command, args []string) error {
354352
return thisCmd.Run(args)
@@ -544,6 +542,23 @@ It("return error", func() {
544542
})
545543
```
546544
545+
## Adding Examples
546+
547+
Use the CobraCLI Example property when possible. `vs upgrade` for an example:
548+
549+
```go
550+
cobraCmd := &cobra.Command{
551+
Use: "upgrade " + T("IDENTIFIER"),
552+
Short: T("Upgrade a virtual server instance"),
553+
Long: T(`Note: This virtual server will be rebooted once the upgrade order is placed.
554+
The instance is halted until the upgrade transaction is completed. However for Network, no reboot is required.`) + `
555+
` + T(`The -c and -m options are for dedicated VSI upgrade, most VSIs will need to upgrade with --flavor.
556+
See '${COMMAND_NAME} sl vs options' for flavor keyNames to use.`),
557+
Example: `${COMMAND_NAME} sl vs upgrade 12345678 --flavor B1_8X32X25`,
558+
```
559+
560+
This helps make the strings a bit easier to translate.
561+
547562
548563
# Plugin Support / Release Process
549564
After v1.4.1 `sl` will be a normal plugin, so where are the instructions to build the plugin.

0 commit comments

Comments
 (0)