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

added subcommands to the cli reference #1793

Merged
merged 2 commits into from
Mar 14, 2019
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
31 changes: 22 additions & 9 deletions cmd/skaffold/man/man.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"fmt"
"github.com/spf13/cobra"
"os"
"text/template"

Expand All @@ -26,7 +27,7 @@ import (
)

const manTemplate = `
### skaffold {{.Name}}
### {{.UseLine}}

{{.Short}}

Expand All @@ -39,18 +40,30 @@ const manTemplate = `
func main() {
command := cmd.NewSkaffoldCommand(os.Stdout, os.Stderr)
for _, command := range command.Commands() {
tmpl, err := template.New("test").Parse(manTemplate)
if err != nil {
panic(err)
}
err = tmpl.Execute(os.Stdout, command)
if err != nil {
panic(err)
}
printCommand(command)
}
}

func printCommand(command *cobra.Command) {
command.DisableFlagsInUseLine = true
tmpl, err := template.New("test").Parse(manTemplate)
if err != nil {
panic(err)
}
err = tmpl.Execute(os.Stdout, command)
if err != nil {
panic(err)
}
if len(command.Flags().Args()) > 0 {
fmt.Println("Env vars:")
fmt.Println("")
command.LocalFlags().VisitAll(func(flag *pflag.Flag) {
fmt.Printf("* `%s` (same as --%s)\n", cmd.FlagToEnvVarName(flag), flag.Name)
})
}
if command.HasSubCommands() {
for _, subCommand := range command.Commands() {
printCommand(subCommand)
}
}
}
182 changes: 71 additions & 111 deletions docs/content/en/docs/references/cli/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Builds the artifacts

```
Usage:
skaffold build [flags]
skaffold build
Flags:
-b, --build-image stringArray Choose which artifacts to build. Artifacts with image names that contain the expression will be built only. Default is to build sources for all artifacts
Expand All @@ -84,38 +84,21 @@ Global Flags:
```
Env vars:

* `SKAFFOLD_BUILD_IMAGE` (same as --build-image)
* `SKAFFOLD_CACHE_ARTIFACTS` (same as --cache-artifacts)
* `SKAFFOLD_CACHE_FILE` (same as --cache-file)
* `SKAFFOLD_DEFAULT_REPO` (same as --default-repo)
* `SKAFFOLD_ENABLE_RPC` (same as --enable-rpc)
* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_NAMESPACE` (same as --namespace)
* `SKAFFOLD_OUTPUT` (same as --output)
* `SKAFFOLD_PROFILE` (same as --profile)
* `SKAFFOLD_QUIET` (same as --quiet)
* `SKAFFOLD_RPC_PORT` (same as --rpc-port)
* `SKAFFOLD_SKIP_TESTS` (same as --skip-tests)
* `SKAFFOLD_TOOT` (same as --toot)

### skaffold completion

### skaffold completion SHELL

Output shell completion for the given shell (bash or zsh)

```
Usage:
skaffold completion SHELL [flags]
skaffold completion SHELL
Global Flags:
--color int Specify the default output color in ANSI escape codes (default 34)
-v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning")
```
Env vars:


### skaffold config

Expand All @@ -138,16 +121,74 @@ Use "skaffold config [command] --help" for more information about a command.
```
Env vars:

### skaffold config list

List all values set in the global Skaffold config

```
Usage:
skaffold config list
Flags:
-a, --all Show values for all kubecontexts
-c, --config string Path to Skaffold config
-k, --kube-context string Kubectl context to set values against
Global Flags:
--color int Specify the default output color in ANSI escape codes (default 34)
-v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning")
```

### skaffold config set

Set a value in the global Skaffold config

```
Usage:
skaffold config set
Flags:
-c, --config string Path to Skaffold config
-g, --global Set value for global config
-k, --kube-context string Kubectl context to set values against
Global Flags:
--color int Specify the default output color in ANSI escape codes (default 34)
-v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning")
```

### skaffold config unset

Unset a value in the global Skaffold config

```
Usage:
skaffold config unset
Flags:
-c, --config string Path to Skaffold config
-g, --global Set value for global config
-k, --kube-context string Kubectl context to set values against
Global Flags:
--color int Specify the default output color in ANSI escape codes (default 34)
-v, --verbosity string Log level (debug, info, warn, error, fatal, panic) (default "warning")
```

### skaffold delete

Delete the deployed resources

```
Usage:
skaffold delete [flags]
skaffold delete
Flags:
--cache-artifacts Set to true to enable caching of artifacts.
Expand All @@ -167,26 +208,14 @@ Global Flags:
```
Env vars:

* `SKAFFOLD_CACHE_ARTIFACTS` (same as --cache-artifacts)
* `SKAFFOLD_CACHE_FILE` (same as --cache-file)
* `SKAFFOLD_DEFAULT_REPO` (same as --default-repo)
* `SKAFFOLD_ENABLE_RPC` (same as --enable-rpc)
* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_NAMESPACE` (same as --namespace)
* `SKAFFOLD_PROFILE` (same as --profile)
* `SKAFFOLD_RPC_PORT` (same as --rpc-port)
* `SKAFFOLD_SKIP_TESTS` (same as --skip-tests)
* `SKAFFOLD_TOOT` (same as --toot)

### skaffold deploy

Deploys the artifacts

```
Usage:
skaffold deploy [flags]
skaffold deploy
Flags:
--cache-artifacts Set to true to enable caching of artifacts.
Expand All @@ -209,29 +238,14 @@ Global Flags:
```
Env vars:

* `SKAFFOLD_CACHE_ARTIFACTS` (same as --cache-artifacts)
* `SKAFFOLD_CACHE_FILE` (same as --cache-file)
* `SKAFFOLD_DEFAULT_REPO` (same as --default-repo)
* `SKAFFOLD_ENABLE_RPC` (same as --enable-rpc)
* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_IMAGES` (same as --images)
* `SKAFFOLD_LABEL` (same as --label)
* `SKAFFOLD_NAMESPACE` (same as --namespace)
* `SKAFFOLD_PROFILE` (same as --profile)
* `SKAFFOLD_RPC_PORT` (same as --rpc-port)
* `SKAFFOLD_SKIP_TESTS` (same as --skip-tests)
* `SKAFFOLD_TAIL` (same as --tail)
* `SKAFFOLD_TOOT` (same as --toot)

### skaffold dev

Runs a pipeline file in development mode

```
Usage:
skaffold dev [flags]
skaffold dev
Flags:
--cache-artifacts Set to true to enable caching of artifacts.
Expand Down Expand Up @@ -259,34 +273,14 @@ Global Flags:
```
Env vars:

* `SKAFFOLD_CACHE_ARTIFACTS` (same as --cache-artifacts)
* `SKAFFOLD_CACHE_FILE` (same as --cache-file)
* `SKAFFOLD_CLEANUP` (same as --cleanup)
* `SKAFFOLD_DEFAULT_REPO` (same as --default-repo)
* `SKAFFOLD_ENABLE_RPC` (same as --enable-rpc)
* `SKAFFOLD_EXPERIMENTAL_GUI` (same as --experimental-gui)
* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_LABEL` (same as --label)
* `SKAFFOLD_NAMESPACE` (same as --namespace)
* `SKAFFOLD_PORT_FORWARD` (same as --port-forward)
* `SKAFFOLD_PROFILE` (same as --profile)
* `SKAFFOLD_RPC_PORT` (same as --rpc-port)
* `SKAFFOLD_SKIP_TESTS` (same as --skip-tests)
* `SKAFFOLD_TAIL` (same as --tail)
* `SKAFFOLD_TOOT` (same as --toot)
* `SKAFFOLD_TRIGGER` (same as --trigger)
* `SKAFFOLD_WATCH_IMAGE` (same as --watch-image)
* `SKAFFOLD_WATCH_POLL_INTERVAL` (same as --watch-poll-interval)

### skaffold diagnose

Run a diagnostic on Skaffold

```
Usage:
skaffold diagnose [flags]
skaffold diagnose
Flags:
-f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml")
Expand All @@ -298,18 +292,14 @@ Global Flags:
```
Env vars:

* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_PROFILE` (same as --profile)

### skaffold fix

Converts old Skaffold config to newest schema version

```
Usage:
skaffold fix [flags]
skaffold fix
Flags:
-f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml")
Expand All @@ -321,18 +311,14 @@ Global Flags:
```
Env vars:

* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_OVERWRITE` (same as --overwrite)

### skaffold init

Automatically generate Skaffold configuration for deploying an application

```
Usage:
skaffold init [flags]
skaffold init
Flags:
--analyze Print all discoverable Dockerfiles and images in JSON format to stdout
Expand All @@ -349,22 +335,14 @@ Global Flags:
```
Env vars:

* `SKAFFOLD_ANALYZE` (same as --analyze)
* `SKAFFOLD_ARTIFACT` (same as --artifact)
* `SKAFFOLD_COMPOSE_FILE` (same as --compose-file)
* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_FORCE` (same as --force)
* `SKAFFOLD_SKIP_BUILD` (same as --skip-build)

### skaffold run

Runs a pipeline file

```
Usage:
skaffold run [flags]
skaffold run
Flags:
--cache-artifacts Set to true to enable caching of artifacts.
Expand All @@ -387,29 +365,14 @@ Global Flags:
```
Env vars:

* `SKAFFOLD_CACHE_ARTIFACTS` (same as --cache-artifacts)
* `SKAFFOLD_CACHE_FILE` (same as --cache-file)
* `SKAFFOLD_DEFAULT_REPO` (same as --default-repo)
* `SKAFFOLD_ENABLE_RPC` (same as --enable-rpc)
* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_LABEL` (same as --label)
* `SKAFFOLD_NAMESPACE` (same as --namespace)
* `SKAFFOLD_PROFILE` (same as --profile)
* `SKAFFOLD_RPC_PORT` (same as --rpc-port)
* `SKAFFOLD_SKIP_TESTS` (same as --skip-tests)
* `SKAFFOLD_TAG` (same as --tag)
* `SKAFFOLD_TAIL` (same as --tail)
* `SKAFFOLD_TOOT` (same as --toot)

### skaffold version

Print the version information

```
Usage:
skaffold version [flags]
skaffold version
Flags:
-o, --output *flags.TemplateFlag Format output with go-template. For full struct documentation, see https://godoc.org/github.com/GoogleContainerTools/skaffold/pkg/skaffold/version#Info (default {{.Version}}
Expand All @@ -421,6 +384,3 @@ Global Flags:
```
Env vars:

* `SKAFFOLD_OUTPUT` (same as --output)