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

Add command docs and job to check it #211

Merged
merged 3 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
add command docs
Signed-off-by: cpanato <ctadeu@gmail.com>
  • Loading branch information
cpanato committed Sep 16, 2022
commit cf05164323b20f09db87d71b9ae3bee56f3fcfab
51 changes: 51 additions & 0 deletions cr/cmd/docGen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright The Helm Authors
//
// 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 (
"fmt"

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

var generateDocsCmd = &cobra.Command{
Use: "doc-gen",
Short: "Generate documentation",
Long: heredoc.Doc(`
Generate documentation for all commands
to the 'docs' directory.`),
Hidden: true,
RunE: generateDocs,
}

func generateDocs(cmd *cobra.Command, args []string) error {
fmt.Println("Generating docs...")

err := doc.GenMarkdownTree(rootCmd.Root(), "doc")
if err != nil {
return err
}

fmt.Println("Done.")
return nil
}

func init() {
rootCmd.AddCommand(generateDocsCmd)

rootCmd.DisableAutoGenTag = true
}
26 changes: 26 additions & 0 deletions doc/cr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## cr

Helm Chart Repos on Github Pages

### Synopsis


Create Helm chart repositories on GitHub Pages by uploading Chart packages
and Chart metadata to GitHub Releases and creating a suitable index file


### Options

```
--config string Config file (default is $HOME/.cr.yaml)
-h, --help help for cr
```

### SEE ALSO

* [cr completion](cr_completion.md) - Generate the autocompletion script for the specified shell
* [cr index](cr_index.md) - Update Helm repo index.yaml for the given GitHub repo
* [cr package](cr_package.md) - Package Helm charts
* [cr upload](cr_upload.md) - Upload Helm chart packages to GitHub Releases
* [cr version](cr_version.md) - Print version information

30 changes: 30 additions & 0 deletions doc/cr_completion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## cr completion

Generate the autocompletion script for the specified shell

### Synopsis

Generate the autocompletion script for cr 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
```

### Options inherited from parent commands

```
--config string Config file (default is $HOME/.cr.yaml)
```

### SEE ALSO

* [cr](cr.md) - Helm Chart Repos on Github Pages
* [cr completion bash](cr_completion_bash.md) - Generate the autocompletion script for bash
* [cr completion fish](cr_completion_fish.md) - Generate the autocompletion script for fish
* [cr completion powershell](cr_completion_powershell.md) - Generate the autocompletion script for powershell
* [cr completion zsh](cr_completion_zsh.md) - Generate the autocompletion script for zsh

49 changes: 49 additions & 0 deletions doc/cr_completion_bash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## cr 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 <(cr completion bash)

To load completions for every new session, execute once:

#### Linux:

cr completion bash > /etc/bash_completion.d/cr

#### macOS:

cr completion bash > $(brew --prefix)/etc/bash_completion.d/cr

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


```
cr completion bash
```

### Options

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

### Options inherited from parent commands

```
--config string Config file (default is $HOME/.cr.yaml)
```

### SEE ALSO

* [cr completion](cr_completion.md) - Generate the autocompletion script for the specified shell

40 changes: 40 additions & 0 deletions doc/cr_completion_fish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## cr 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:

cr completion fish | source

To load completions for every new session, execute once:

cr completion fish > ~/.config/fish/completions/cr.fish

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


```
cr completion fish [flags]
```

### Options

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

### Options inherited from parent commands

```
--config string Config file (default is $HOME/.cr.yaml)
```

### SEE ALSO

* [cr completion](cr_completion.md) - Generate the autocompletion script for the specified shell

37 changes: 37 additions & 0 deletions doc/cr_completion_powershell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## cr completion powershell

Generate the autocompletion script for powershell

### Synopsis

Generate the autocompletion script for powershell.

To load completions in your current shell session:

cr completion powershell | Out-String | Invoke-Expression

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


```
cr completion powershell [flags]
```

### Options

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

### Options inherited from parent commands

```
--config string Config file (default is $HOME/.cr.yaml)
```

### SEE ALSO

* [cr completion](cr_completion.md) - Generate the autocompletion script for the specified shell

51 changes: 51 additions & 0 deletions doc/cr_completion_zsh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## cr 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 in your current shell session:

source <(cr completion zsh); compdef _cr cr

To load completions for every new session, execute once:

#### Linux:

cr completion zsh > "${fpath[1]}/_cr"

#### macOS:

cr completion zsh > $(brew --prefix)/share/zsh/site-functions/_cr

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


```
cr completion zsh [flags]
```

### Options

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

### Options inherited from parent commands

```
--config string Config file (default is $HOME/.cr.yaml)
```

### SEE ALSO

* [cr completion](cr_completion.md) - Generate the autocompletion script for the specified shell

44 changes: 44 additions & 0 deletions doc/cr_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## cr index

Update Helm repo index.yaml for the given GitHub repo

### Synopsis


Update a Helm chart repository index.yaml file based on a the
given GitHub repository's releases.


```
cr index [flags]
```

### Options

```
-b, --git-base-url string GitHub Base URL (only needed for private GitHub) (default "https://api.github.com/")
-r, --git-repo string GitHub repository
-u, --git-upload-url string GitHub Upload URL (only needed for private GitHub) (default "https://uploads.github.com/")
-h, --help help for index
-i, --index-path string Path to index file (default ".cr-index/index.yaml")
-o, --owner string GitHub username or organization
-p, --package-path string Path to directory with chart packages (default ".cr-release-packages")
--pages-branch string The GitHub pages branch (default "gh-pages")
--pages-index-path string The GitHub pages index path (default "index.yaml")
--pr Create a pull request for index.yaml against the GitHub Pages branch (must not be set if --push is set)
--push Push index.yaml to the GitHub Pages branch (must not be set if --pr is set)
--release-name-template string Go template for computing release names, using chart metadata (default "{{ .Name }}-{{ .Version }}")
--remote string The Git remote used when creating a local worktree for the GitHub Pages branch (default "origin")
-t, --token string GitHub Auth Token (only needed for private repos)
```

### Options inherited from parent commands

```
--config string Config file (default is $HOME/.cr.yaml)
```

### SEE ALSO

* [cr](cr.md) - Helm Chart Repos on Github Pages

39 changes: 39 additions & 0 deletions doc/cr_package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## cr package

Package Helm charts

### Synopsis

This command packages a chart into a versioned chart archive file. If a path
is given, this will look at that path for a chart (which must contain a
Chart.yaml file) and then package that directory.


If you wish to use advanced packaging options such as creating signed
packages or updating chart dependencies please use "helm package" instead.

```
cr package [CHART_PATH] [...] [flags]
```

### Options

```
-h, --help help for package
--key string Name of the key to use when signing
--keyring string Location of a public keyring (default "/Users/cpanato/.gnupg/pubring.gpg")
-p, --package-path string Path to directory with chart packages (default ".cr-release-packages")
--passphrase-file string Location of a file which contains the passphrase for the signing key. Use '-' in order to read from stdin
--sign Use a PGP private key to sign this package
```

### Options inherited from parent commands

```
--config string Config file (default is $HOME/.cr.yaml)
```

### SEE ALSO

* [cr](cr.md) - Helm Chart Repos on Github Pages

Loading