-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: add documentation generator (#1181)
Co-authored-by: Rémy Léone <rleone@scaleway.com>
- Loading branch information
1 parent
5150184
commit 841acb9
Showing
31 changed files
with
5,921 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/scaleway/scaleway-cli/internal/namespaces" | ||
) | ||
|
||
// This command is used to generate markdown documentation for each commands (custom or generated) of the CLI | ||
func main() { | ||
commands := namespaces.GetCommands() | ||
for _, c := range commands.GetAll() { | ||
if c.Namespace == "instance" { | ||
fmt.Printf("%s %s %s | %s\n", c.Namespace, c.Resource, c.Verb, c.Short) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/scaleway/scaleway-cli/internal/docgen" | ||
"github.com/scaleway/scaleway-cli/internal/namespaces" | ||
) | ||
|
||
// This command is used to generate markdown documentation for each commands (custom or generated) of the CLI | ||
func main() { | ||
commands := namespaces.GetCommands() | ||
|
||
outDir := flag.String("outdir", "./docs/commands", "Directory where markdown will be created") | ||
flag.Parse() | ||
|
||
stats, err := os.Stat(*outDir) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
if !stats.IsDir() { | ||
panic(fmt.Errorf("outdir %s must be a valid directory", *outDir)) | ||
} | ||
|
||
err = docgen.GenerateDocs(commands, *outDir) | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 | ||
🟥🟥🟥 STDERR️️ 🟥🟥🟥️ | ||
Autocomplete related commands | ||
|
||
USAGE: | ||
scw autocomplete <command> | ||
|
||
AVAILABLE COMMANDS: | ||
install Install autocomplete script | ||
script Show autocomplete script for current shell | ||
|
||
FLAGS: | ||
-h, --help help for autocomplete | ||
|
||
GLOBAL FLAGS: | ||
-c, --config string The path to the config file | ||
-D, --debug Enable debug mode | ||
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human") | ||
-p, --profile string The config profile to use | ||
|
||
Use "scw autocomplete [command] --help" for more information about a command. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
<!-- DO NOT EDIT: this file is automatically generated using scw-doc-gen --> | ||
# Documentation for `scw account` | ||
Account API | ||
|
||
- [SSH keys management commands](#ssh-keys-management-commands) | ||
- [Add a SSH key to your organization](#add-a-ssh-key-to-your-organization) | ||
- [Get a SSH key from your organization](#get-a-ssh-key-from-your-organization) | ||
- [Initialize SSH key](#initialize-ssh-key) | ||
- [List all SSH keys of your organization](#list-all-ssh-keys-of-your-organization) | ||
- [Remove a SSH key from your organization](#remove-a-ssh-key-from-your-organization) | ||
- [Update a SSH key on your organization](#update-a-ssh-key-on-your-organization) | ||
|
||
|
||
## SSH keys management commands | ||
|
||
SSH keys management commands. | ||
|
||
|
||
### Add a SSH key to your organization | ||
|
||
Add a SSH key to your organization. | ||
|
||
**Usage:** | ||
|
||
``` | ||
scw account ssh-key add [arg=value ...] | ||
``` | ||
|
||
|
||
**Args:** | ||
|
||
| Name | | Description | | ||
|------|---|-------------| | ||
| name | | The name of the SSH key | | ||
| public-key | Required | SSH public key. Currently ssh-rsa, ssh-dss (DSA), ssh-ed25519 and ecdsa keys with NIST curves are supported | | ||
| project-id | | Project owning the resource | | ||
| organization-id | | Organization ID to use. If none is passed will use default organization ID from the config | | ||
|
||
|
||
**Examples:** | ||
|
||
|
||
Add a given ssh key | ||
``` | ||
scw account ssh-key add name=foobar public_key="$(cat <path/to/your/public/key>)" | ||
``` | ||
|
||
|
||
|
||
|
||
### Get a SSH key from your organization | ||
|
||
Get a SSH key from your organization. | ||
|
||
**Usage:** | ||
|
||
``` | ||
scw account ssh-key get <ssh-key-id ...> [arg=value ...] | ||
``` | ||
|
||
|
||
**Args:** | ||
|
||
| Name | | Description | | ||
|------|---|-------------| | ||
| ssh-key-id | Required | The ID of the SSH key | | ||
|
||
|
||
|
||
### Initialize SSH key | ||
|
||
Initialize SSH key. | ||
|
||
**Usage:** | ||
|
||
``` | ||
scw account ssh-key init | ||
``` | ||
|
||
|
||
|
||
### List all SSH keys of your organization | ||
|
||
List all SSH keys of your organization. | ||
|
||
**Usage:** | ||
|
||
``` | ||
scw account ssh-key list [arg=value ...] | ||
``` | ||
|
||
|
||
**Args:** | ||
|
||
| Name | | Description | | ||
|------|---|-------------| | ||
| order-by | One of: `created_at_asc`, `created_at_desc`, `updated_at_asc`, `updated_at_desc`, `name_asc`, `name_desc` | | | ||
| name | | | | ||
| project-id | | | | ||
| organization-id | | | | ||
|
||
|
||
|
||
### Remove a SSH key from your organization | ||
|
||
Remove a SSH key from your organization. | ||
|
||
**Usage:** | ||
|
||
``` | ||
scw account ssh-key remove <ssh-key-id ...> [arg=value ...] | ||
``` | ||
|
||
|
||
**Args:** | ||
|
||
| Name | | Description | | ||
|------|---|-------------| | ||
| ssh-key-id | Required | | | ||
|
||
|
||
**Examples:** | ||
|
||
|
||
Remove a given SSH key | ||
``` | ||
scw account ssh-key remove 11111111-1111-1111-1111-111111111111 | ||
``` | ||
|
||
|
||
|
||
|
||
### Update a SSH key on your organization | ||
|
||
Update a SSH key on your organization. | ||
|
||
**Usage:** | ||
|
||
``` | ||
scw account ssh-key update <ssh-key-id ...> [arg=value ...] | ||
``` | ||
|
||
|
||
**Args:** | ||
|
||
| Name | | Description | | ||
|------|---|-------------| | ||
| ssh-key-id | Required | | | ||
| name | | | | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!-- DO NOT EDIT: this file is automatically generated using scw-doc-gen --> | ||
# Documentation for `scw autocomplete` | ||
Autocomplete related commands | ||
|
||
- [Install autocomplete script](#install-autocomplete-script) | ||
- [Show autocomplete script for current shell](#show-autocomplete-script-for-current-shell) | ||
|
||
|
||
## Install autocomplete script | ||
|
||
Install autocomplete script for a given shell and OS. | ||
|
||
Install autocomplete script for a given shell and OS. | ||
|
||
**Usage:** | ||
|
||
``` | ||
scw autocomplete install [arg=value ...] | ||
``` | ||
|
||
|
||
**Args:** | ||
|
||
| Name | | Description | | ||
|------|---|-------------| | ||
| shell | | | | ||
|
||
|
||
|
||
## Show autocomplete script for current shell | ||
|
||
Show autocomplete script for current shell. | ||
|
||
Show autocomplete script for current shell. | ||
|
||
**Usage:** | ||
|
||
``` | ||
scw autocomplete script [arg=value ...] | ||
``` | ||
|
||
|
||
**Args:** | ||
|
||
| Name | | Description | | ||
|------|---|-------------| | ||
| shell | Default: `/bin/zsh` | | | ||
|
||
|
||
|
Oops, something went wrong.