Skip to content

Commit

Permalink
Update output for wego app subcommand (#421)
Browse files Browse the repository at this point in the history
* Skip building UI on unit-tests target

* Remove docker scan-and-push CI job

* Update output for wego app subcommand

* Update output for wego app subcommand

* remove --namespace from examples

* fix wego examples

* removed extraneous newline

* add namespace option erroneously removed

* cleanup examples

* more example updates

* minor tweaks to app examples

* add list subcommand to wego app add command

* revert change to 'wego app add' usage

* fix_example_in_main

* Fix typo

Co-authored-by: Jordan Pellizzari <jordan@weave.works>
  • Loading branch information
D3nn and jpellizzari committed Jul 15, 2021
1 parent f7f9435 commit 3af23b5
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Usage:
wego [command]

Available Commands:
app Add or Status application
app Add or status application
flux Use flux commands
help Help about any command
install Install or upgrade Wego
Expand Down
19 changes: 14 additions & 5 deletions cmd/wego/app/add/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,19 @@ var Cmd = &cobra.Command{
Use: "add [--name <name>] [--url <url>] [--branch <branch>] [--path <path within repository>] [--private-key <keyfile>] <repository directory>",
Short: "Add a workload repository to a wego cluster",
Long: strings.TrimSpace(dedent.Dedent(`
Associates an additional application in a git repository with a wego cluster so that its contents may be managed via GitOps
`)),
Example: "wego app add .",
RunE: runCmd,
Associates an additional application in a git repository with a wego cluster so that its contents may be managed via GitOps
`)),
Example: `
# Add application to wego control from local git repository
wego app add .
# Add podinfo application to wego control from github repository
wego app add --url git@github.com:myorg/podinfo
# Get status of podinfo application
wego app status podinfo
`,
RunE: runCmd,
SilenceUsage: true,
SilenceErrors: true,
PostRun: func(cmd *cobra.Command, args []string) {
Expand All @@ -43,7 +52,7 @@ var Cmd = &cobra.Command{
}

func init() {
Cmd.Flags().StringVar(&params.Name, "name", "", "Name of remote git repository")
Cmd.Flags().StringVar(&params.Name, "name", "", "Name of application")
Cmd.Flags().StringVar(&params.Url, "url", "", "URL of remote repository")
Cmd.Flags().StringVar(&params.Path, "path", "./", "Path of files within git repository")
Cmd.Flags().StringVar(&params.Branch, "branch", "main", "Branch to watch within git repository")
Expand Down
12 changes: 11 additions & 1 deletion cmd/wego/app/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ import (
)

var ApplicationCmd = &cobra.Command{
Use: "app [subcommand]",
Use: "app",
Short: "Manages your applications",
Example:`
# Add an application to wego from local git repository
wego app add . --name <app-name>
# Status an application under wego control
wego app status <app-name>
# List applications under wego control
wego app list`,
Args: cobra.MinimumNArgs(1),
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/wego/app/list/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

var Cmd = &cobra.Command{
Use: "list",
Short: "List applications",
Short: "List applications under wego control",
Example: "wego app list",
RunE: runCmd,
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/wego/app/status/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (

var Cmd = &cobra.Command{
Use: "status <app-name>",
Short: "Get status of an app",
Short: "Get status of a workload under wego control",
Args: cobra.MinimumNArgs(1),
SilenceUsage: true,
SilenceErrors: true,
SilenceUsage: true,
SilenceErrors: true,
Example: "wego app status podinfo",
RunE: func(cmd *cobra.Command, args []string) error {
params := app.StatusParams{}
Expand Down
43 changes: 40 additions & 3 deletions cmd/wego/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,46 @@ var options struct {
}

var rootCmd = &cobra.Command{
Use: "wego",
Short: "Weave GitOps",
Use: "wego",
SilenceUsage: true,
SilenceErrors: true,
Short: "Weave GitOps",
Long: "Command line utility for managing Kubernetes applications via GitOps.",
Example:`
# Get verbose output for any wego command
wego [command] -v, --verbose
# Get wego app help
wego help app
# Add application to wego control from a local git repository
wego app add . --name <myapp>
OR
wego app add <myapp-directory>
# Add application to wego control from a github repository
wego app add \
--name <myapp> \
--url git@github.com:myorg/<myapp> \
--private-key ${HOME}/.ssh/<SSH key for myapp> \
--branch prod-<myapp>
# Get status of application under wego control
wego app status podinfo
# Get help for wego app add command
wego app add -h
wego help app add
# Show manifests that would be installed by the wego gitops install command
wego gitops install --dry-run
# Install wego in the wego-system namespace
wego gitops install
# Get the version of wego along with commit, branch, and flux version
wego version
`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
configureLogger()
},
Expand Down Expand Up @@ -49,5 +87,4 @@ func main() {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}

}

0 comments on commit 3af23b5

Please sign in to comment.