Skip to content

Commit

Permalink
Add docs command and autogenerated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanFrench committed Nov 30, 2021
1 parent b077ad9 commit a6dbd39
Show file tree
Hide file tree
Showing 9 changed files with 305 additions and 0 deletions.
55 changes: 55 additions & 0 deletions cmd/docs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd

import (
"log"

"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
)

// docsCmd represents the docs command
var docsCmd = &cobra.Command{
Use: "docs",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
err := doc.GenMarkdownTree(rootCmd, "./docs")
if err != nil {
log.Fatal(err)
}
},
}

func init() {
rootCmd.AddCommand(docsCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// docsCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// docsCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
32 changes: 32 additions & 0 deletions docs/aws-auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## aws-auth

Assume a role in AWS and optionally run a command

### Synopsis


Run a command within the context of assuming a role. This is not persistent, and will only affect the command that is passed in.

e.g.

aws-auth --role-arn=arn:aws:iam::1234567890:role/my-role aws s3 ls

```
aws-auth --role-arn=[role] [command]
```

### Options

```
-d, --duration int The duration, in seconds, for the role to be assumed (default 3600)
-h, --help help for aws-auth
-r, --role-arn string The arn of the role to assume in AWS (required)
```

### SEE ALSO

* [aws-auth completion](aws-auth_completion.md) - generate the autocompletion script for the specified shell
* [aws-auth docs](aws-auth_docs.md) - A brief description of your command
* [aws-auth version](aws-auth_version.md) - Returns the version of aws-auth

###### Auto generated by spf13/cobra on 30-Nov-2021
26 changes: 26 additions & 0 deletions docs/aws-auth_completion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## aws-auth completion

generate the autocompletion script for the specified shell

### Synopsis


Generate the autocompletion script for aws-auth for the specified shell.
See each sub-command's help for details on how to use the generated script.


### Options

```
-h, --help help for completion
```

### SEE ALSO

* [aws-auth](aws-auth.md) - Assume a role in AWS and optionally run a command
* [aws-auth completion bash](aws-auth_completion_bash.md) - generate the autocompletion script for bash
* [aws-auth completion fish](aws-auth_completion_fish.md) - generate the autocompletion script for fish
* [aws-auth completion powershell](aws-auth_completion_powershell.md) - generate the autocompletion script for powershell
* [aws-auth completion zsh](aws-auth_completion_zsh.md) - generate the autocompletion script for zsh

###### Auto generated by spf13/cobra on 30-Nov-2021
40 changes: 40 additions & 0 deletions docs/aws-auth_completion_bash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## aws-auth completion bash

generate the autocompletion script for bash

### Synopsis


Generate the autocompletion script for the bash shell.

This script depends on the 'bash-completion' package.
If it is not installed already, you can install it via your OS's package manager.

To load completions in your current shell session:
$ source <(aws-auth completion bash)

To load completions for every new session, execute once:
Linux:
$ aws-auth completion bash > /etc/bash_completion.d/aws-auth
MacOS:
$ aws-auth completion bash > /usr/local/etc/bash_completion.d/aws-auth

You will need to start a new shell for this setup to take effect.


```
aws-auth completion bash
```

### Options

```
-h, --help help for bash
--no-descriptions disable completion descriptions
```

### SEE ALSO

* [aws-auth completion](aws-auth_completion.md) - generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 30-Nov-2021
34 changes: 34 additions & 0 deletions docs/aws-auth_completion_fish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## aws-auth completion fish

generate the autocompletion script for fish

### Synopsis


Generate the autocompletion script for the fish shell.

To load completions in your current shell session:
$ aws-auth completion fish | source

To load completions for every new session, execute once:
$ aws-auth completion fish > ~/.config/fish/completions/aws-auth.fish

You will need to start a new shell for this setup to take effect.


```
aws-auth completion fish [flags]
```

### Options

```
-h, --help help for fish
--no-descriptions disable completion descriptions
```

### SEE ALSO

* [aws-auth completion](aws-auth_completion.md) - generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 30-Nov-2021
32 changes: 32 additions & 0 deletions docs/aws-auth_completion_powershell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## aws-auth completion powershell

generate the autocompletion script for powershell

### Synopsis


Generate the autocompletion script for powershell.

To load completions in your current shell session:
PS C:\> aws-auth completion powershell | Out-String | Invoke-Expression

To load completions for every new session, add the output of the above command
to your powershell profile.


```
aws-auth completion powershell [flags]
```

### Options

```
-h, --help help for powershell
--no-descriptions disable completion descriptions
```

### SEE ALSO

* [aws-auth completion](aws-auth_completion.md) - generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 30-Nov-2021
39 changes: 39 additions & 0 deletions docs/aws-auth_completion_zsh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## aws-auth completion zsh

generate the autocompletion script for zsh

### Synopsis


Generate the autocompletion script for the zsh shell.

If shell completion is not already enabled in your environment you will need
to enable it. You can execute the following once:

$ echo "autoload -U compinit; compinit" >> ~/.zshrc

To load completions for every new session, execute once:
# Linux:
$ aws-auth completion zsh > "${fpath[1]}/_aws-auth"
# macOS:
$ aws-auth completion zsh > /usr/local/share/zsh/site-functions/_aws-auth

You will need to start a new shell for this setup to take effect.


```
aws-auth completion zsh [flags]
```

### Options

```
-h, --help help for zsh
--no-descriptions disable completion descriptions
```

### SEE ALSO

* [aws-auth completion](aws-auth_completion.md) - generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 30-Nov-2021
28 changes: 28 additions & 0 deletions docs/aws-auth_docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## aws-auth docs

A brief description of your command

### Synopsis

A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:

Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.

```
aws-auth docs [flags]
```

### Options

```
-h, --help help for docs
```

### SEE ALSO

* [aws-auth](aws-auth.md) - Assume a role in AWS and optionally run a command

###### Auto generated by spf13/cobra on 30-Nov-2021
19 changes: 19 additions & 0 deletions docs/aws-auth_version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## aws-auth version

Returns the version of aws-auth

```
aws-auth version [flags]
```

### Options

```
-h, --help help for version
```

### SEE ALSO

* [aws-auth](aws-auth.md) - Assume a role in AWS and optionally run a command

###### Auto generated by spf13/cobra on 30-Nov-2021

0 comments on commit a6dbd39

Please sign in to comment.