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

Removes viper dependency by removing cobra/ CLI tool #1604

Merged
merged 1 commit into from Mar 10, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
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
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
jpmcb marked this conversation as resolved.
Show resolved Hide resolved
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
@@ -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.

jpmcb marked this conversation as resolved.
Show resolved Hide resolved
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.