Skip to content

Commit

Permalink
Removes viper dependency by removing cobra/ CLI tool (#1604)
Browse files Browse the repository at this point in the history
The cobra bootstrapping CLI tool has moved to
https://github.com/spf13/cobra-cli

Signed-off-by: John McBride <jmcbride@vmware.com>
  • Loading branch information
jpmcb authored Mar 10, 2022
1 parent 9369465 commit 5b2b9e9
Show file tree
Hide file tree
Showing 34 changed files with 26 additions and 4,747 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
go install github.com/kyoh86/richgo"${_version}"
go install github.com/mitchellh/gox"${_version}"
- run: PATH=$HOME/go/bin/:$PATH make test cobra_generator
- run: PATH=$HOME/go/bin/:$PATH make test

test-win:
name: MINGW64
Expand Down Expand Up @@ -97,4 +97,4 @@ jobs:
go install github.com/kyoh86/richgo@latest
go install github.com/mitchellh/gox@latest
- run: PATH=$HOME/go/bin:$PATH make test cobra_generator
- run: PATH=$HOME/go/bin:$PATH make test
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ ifeq (, $(shell which richgo))
$(warning "could not find richgo in $(PATH), run: go get github.com/kyoh86/richgo")
endif

.PHONY: fmt lint test cobra_generator install_deps clean
.PHONY: fmt lint test install_deps clean

default: all

all: fmt test cobra_generator
all: fmt test

fmt:
$(info ******************** checking formatting ********************)
Expand All @@ -27,11 +27,6 @@ test: install_deps
$(info ******************** running tests ********************)
richgo test -v ./...

cobra_generator: install_deps
$(info ******************** building generator ********************)
mkdir -p $(BIN)
make -C cobra all

install_deps:
$(info ******************** downloading dependencies ********************)
go get -v ./...
Expand Down
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![cobra logo](https://cloud.githubusercontent.com/assets/173412/10886352/ad566232-814f-11e5-9cd0-aa101788c117.png)

Cobra is both a library for creating powerful modern CLI applications as well as a program to generate applications and command files.
Cobra is a library for creating powerful modern CLI applications.

Cobra is used in many Go projects such as [Kubernetes](http://kubernetes.io/),
[Hugo](https://gohugo.io), and [Github CLI](https://github.com/cli/cli) to
Expand All @@ -16,15 +16,11 @@ name a few. [This list](./projects_using_cobra.md) contains a more extensive lis
Cobra is a library providing a simple interface to create powerful modern CLI
interfaces similar to git & go tools.

Cobra is also an application that will generate your application scaffolding to rapidly
develop a Cobra-based application.

Cobra provides:
* Easy subcommand-based CLIs: `app server`, `app fetch`, etc.
* Fully POSIX-compliant flags (including short & long versions)
* Nested subcommands
* Global, local and cascading flags
* Easy generation of applications & commands with `cobra init` & `cobra add cmdname`
* Intelligent suggestions (`app srver`... did you mean `app server`?)
* Automatic help generation for commands and flags
* Automatic help flag recognition of `-h`, `--help`, etc.
Expand Down Expand Up @@ -83,10 +79,11 @@ which maintains the same interface while adding POSIX compliance.

# Installing
Using Cobra is easy. First, use `go get` to install the latest version
of the library. This command will install the `cobra` generator executable
along with the library and its dependencies:
of the library.

go get -u github.com/spf13/cobra
```
go get -u github.com/spf13/cobra@latest
```

Next, include Cobra in your application:

Expand All @@ -95,10 +92,17 @@ import "github.com/spf13/cobra"
```

# Usage
Cobra provides its own program that will create your application and add any
commands you want. It's the easiest way to incorporate Cobra into your application.
`cobra-cli` is a command line program to generate cobra applications and command files.
It will bootstrap your application scaffolding to rapidly
develop a Cobra-based application. It is the easiest way to incorporate Cobra into your application.

It can be installed by running:

```
go install github.com/spf13/cobra-cli@latest
```

For complete details on using the Cobra generator, please read [The Cobra Generator README](https://github.com/spf13/cobra/blob/master/cobra/README.md)
For complete details on using the Cobra-CLI generator, please read [The Cobra Generator README](https://github.com/spf13/cobra-cli/blob/master/README.md)

For complete details on using the Cobra library, please read the [The Cobra User Guide](user_guide.md).

Expand Down
23 changes: 0 additions & 23 deletions cobra/Makefile

This file was deleted.

179 changes: 0 additions & 179 deletions cobra/README.md

This file was deleted.

Loading

0 comments on commit 5b2b9e9

Please sign in to comment.