Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): Add example to --help output 1 #15782

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/argocd/commands/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ compdef _argocd argocd
Optionally, also add the following, in case you are getting errors involving compdef & compinit such as command not found: compdef:
autoload -Uz compinit
compinit
`,
Example: `# For bash
$ source <(argocd completion bash)
# For zsh
$ argocd completion zsh > _argocd
$ source _argocd
`,
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
Expand Down
4 changes: 4 additions & 0 deletions cmd/argocd/commands/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ func NewLogoutCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comma
Use: "logout CONTEXT",
Short: "Log out from Argo CD",
Long: "Log out from Argo CD",
Example: `# To log out of argocd
$ argocd logout
# This can be helpful for security reasons or when you want to switch between different Argo CD contexts or accounts.
`,
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
Expand Down
7 changes: 4 additions & 3 deletions cmd/argocd/commands/relogin.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ func NewReloginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comm
ssoPort int
)
var command = &cobra.Command{
Use: "relogin",
Short: "Refresh an expired authenticate token",
Long: "Refresh an expired authenticate token",
Use: "relogin",
Short: "Refresh an expired authenticate token",
Long: "Refresh an expired authenticate token",
Example: "argocd relogin --password YOUR_PASSWORD",
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down
12 changes: 12 additions & 0 deletions docs/user-guide/commands/argocd_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ compinit
argocd completion SHELL [flags]
```

### Examples

```
# For bash
$ source <(argocd completion bash)
# For zsh
$ argocd completion zsh > _argocd
$ source _argocd
```

### Options

```
Expand Down
9 changes: 9 additions & 0 deletions docs/user-guide/commands/argocd_logout.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ Log out from Argo CD
argocd logout CONTEXT [flags]
```

### Examples

```
# To log out of argocd
$ argocd logout
# This can be helpful for security reasons or when you want to switch between different Argo CD contexts or accounts.
```

### Options

```
Expand Down
6 changes: 6 additions & 0 deletions docs/user-guide/commands/argocd_relogin.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Refresh an expired authenticate token
argocd relogin [flags]
```

### Examples

```
argocd relogin --password YOUR_PASSWORD
```

### Options

```
Expand Down