Commit Graph

156 Commits

Author SHA1 Message Date
Nick Miyake
1be1d2841c Make rootCmd private
Update Cobra generator to make rootCmd private rather than
exporting it. Also update examples in README to use the exported
Execute() command rather than referencing unexported rootCmd.

Fixes #556
2017-11-23 08:13:30 +01:00
Nick Miyake
fb02817f3c Fix README example to be consistent with others (#585)
Alphabetize and separate builtin imports from external imports
to be gofmt-compliant and consistent with other examples in README.
2017-11-22 16:30:46 -05:00
Tyler Butler
d6948b782c Fix minor typo (#579) 2017-11-17 00:24:59 -05:00
Paweł Słomka
b3426bbac1 Remove confusing duplicate Execute from README (#554) 2017-10-29 22:09:45 +01:00
Daniel Nephin
83b1f03962 Add a TraverseChildren option to allow for flags on each command in the hierarchy (#299)
Fix #277 
Fix #467
2017-10-07 23:29:11 +02:00
Shahidh K Muhammed
419e0f8d51 doc: add ReST doc generation (#537) 2017-10-07 19:39:47 +02:00
Albert Nigmatzianov
bc69223348 Fix dead link in README for cobra generator
Fix #542
2017-10-06 21:18:12 +02:00
Albert Nigmatzianov
e8e7fe0355 Shorten README
Fix #501
2017-10-06 12:20:24 +02:00
Albert Nigmatzianov
2df9a53181 Fix MinimumArgs 2017-08-23 12:32:09 +05:00
Albert Nigmatzianov
cb747385b3 Retab README.md 2017-08-23 12:32:09 +05:00
Albert Nigmatzianov
1723331773 Update documentation 2017-08-23 12:32:09 +05:00
Albert Nigmatzianov
8bcacfe133 Add more examples of Args field 2017-08-23 12:32:09 +05:00
joelterry
4a7b7e6586 *following 2017-08-20 07:33:59 +05:00
Albert Nigmatzianov
90fc11bbc0 Update README.md 2017-07-24 09:18:37 +02:00
Daniel Nephin
f20b4e9c32 Refactor TakesArgs to use an interface for arg validation.
Fix some typos in README and comments.
Move arg validation to after flag validation so that the help flag is run first.
Pass the same args to ValidateArgs as the Run methods receive.
Update README.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-07-23 09:57:27 +02:00
Eric Paris
d89c499964 Allow commands to explicitly state if they do, or do not take arbitrary arguments
Check that arguments are in ValidArgs

If a command defined cmd.ValidArgs check that the argument is actually
in ValidArgs and fail if it is not.
2017-07-23 09:57:27 +02:00
Johanan Liebermann
4d647c8944 Print err instead of home
When 'home' can't be determined it doesn't make sense to print it.
The value of 'err' should be printed instead.
2017-06-24 17:01:00 +02:00
Johanan Liebermann
6471e3de04 Rename main func to initConfig
The function called `main` in the manual creation example should be called
`initConfig`.
2017-06-24 16:56:34 +02:00
Johanan Liebermann
f9d34972c1 Fix RootCmd var name
'rootCmd' should be 'RootCmd'.
2017-06-24 16:56:22 +02:00
Johanan Lieberman
d638dcb7c7 Improve readability of README
Improve punctuation, fix capitalization in a couple of places and
rephrase some sentences for better readability.
2017-06-23 19:56:08 +02:00
Brian Danowski
e458bb7ab8 Reword become unexpected errors to encounter errors 2017-06-23 16:17:13 +02:00
Albert Nigmatzianov
d7cfb13474 Update README.md 2017-06-09 21:55:21 +02:00
Martin Marcher
8d4ce3549a Update README.md
Fix description to actually install generator as well as latest version of the library
2017-05-31 06:54:52 +02:00
Albert Nigmatzianov
e606913c4e Fix typos 2017-05-28 12:56:30 +02:00
Albert Nigmatzianov
7918bf6886 Add explanation for viper.BindPflag in README.md
Fix #429

/cc @deltaskelta
2017-05-28 09:16:21 +02:00
Albert Nigmatzianov
ca5710c94e Fix link to cobra lib in README.md 2017-05-19 22:27:40 +02:00
Robert Anthony Bellamy
4ba54a0f7f Edit installation command in README.md (#451) 2017-05-19 21:09:26 +02:00
Don Petersen
90687e7bfc Update pflag link in README (#444)
Cobra is not using ogier/pflag, but a fork of it.
2017-05-12 20:40:24 +02:00
Albert Nigmatzianov
1362f95a8d Clean README.md (#441)
The release notes are obsolete and we better have a release notes
in Github releases

We don't need this TODO as we have godoc

And bitdeli doesn't work and doesn't supported for about 3 years.
2017-05-09 16:18:58 -04:00
Albert Nigmatzianov
1251aefb74 Rename Docker to Moby in README.md 2017-05-09 11:19:15 +02:00
Adrián López
c0bd07d7ba Use cobra create instead of cobra init in README.md (#396) 2017-05-08 14:23:08 +02:00
Albert Nigmatzianov
32756eb440 cmd: Rewrite 2017-05-05 10:35:27 +02:00
Albert Nigmatzianov
8f0203be89 Update README.md 2017-05-02 08:49:35 +02:00
Albert Nigmatzianov
69f86e6d5d Update README.md
See #269
2017-05-01 23:08:34 +02:00
Angel Beltran
bc8a58ff4d docs: Update README.md 2017-05-01 16:51:43 +02:00
Albert Nigmatzianov
c68a90d2e8 Add built-in licenses info to README 2017-04-25 18:25:29 +02:00
Albert Nigmatzianov
63121c8814 Delete Parse from Go projects that uses cobra
http://blog.parse.com/announcements/a-parse-shutdown-reminder/
2017-04-23 22:42:44 +02:00
Nick Craig-Wood
a4f017e545 Add rclone to list of users (#334) 2017-04-23 22:25:25 +02:00
Francesc Campoy
c4f4d75ecc Use go get so missing dependencies are fetched (#406)
If the developer is missing any dependencies, for instance `github.com/spf13/cobra/cobra`, `go install` will fail:

```bash
../../spf13/viper/util.go:29:2: cannot find package "gopkg.in/yaml.v2" in any of:
        /Users/campoy/src/golang.org/x/go/src/gopkg.in/yaml.v2 (from $GOROOT)
        /Users/campoy/src/gopkg.in/yaml.v2 (from $GOPATH)
```

While `go get github.com/spf13/cobra/cobra` will build the tool successfully.
2017-04-23 18:27:01 +02:00
Albert Nigmatzianov
10f6b9d7e1 Make go path bin clearer in README
Fix #324
2017-04-20 21:54:12 +02:00
korya
0a0df1e881 Use valid exit code value in os.Exit call (#405)
Exit code value range is 0-255. I think the examples in the main README document should be valid both syntactically and semantically.
2017-04-17 19:02:17 +02:00
Sebastiaan van Stijn
16c014f1a1 Add "docker" to readme
Docker (https://github.com/docker/docker) now
also uses Cobra for the CLI. A majority of the
commands have been migrated (still some left),
but adding it already :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-03-09 10:45:09 -05:00
Nikola Kovacs
24bb44aac8 Fix SilenceUsage and SilenceErrors in readme (#397)
You have to set them to true to silence the default output, not false.
2017-03-08 14:37:25 -05:00
Philipp Muens
de09d9ce07 Update README with missing import statements (#373) 2016-12-22 10:12:50 -05:00
Qinglan Peng
b62566898a fmt package should be imported (#370)
Signed-off-by: Qinglan Peng <qinglanpeng@zju.edu.cn>
2016-12-14 10:19:52 -05:00
Cao Weiwei
4a087062c6 Fix typo
Signed-off-by: Cao Weiwei <cao.weiwei30@zte.com.cn>
2016-08-29 00:18:06 +08:00
Andrew Au
cb51c97a4e Include instruction for building the cobra tool in README.md 2016-06-29 21:34:17 -07:00
Wesley Merkel
336d629de0 Add godoc badge to README.md (#271) 2016-04-30 09:18:32 -04:00
Ian Walter
9a8186dbb5 Improving createLicenseFile function
Also fixing typo in README example.
2016-04-27 12:03:26 -04:00
Ian Walter
d811f40c6a Adding custom license functionality
* Refactoring code that unnecessarily declares a map before making it.
* Cleaning up gpl3 formatting to match other licenses.
* Adding functionality that allows specifying custom license header
  and text in cobra config.
* Using license header and text as templates so that they can use
  template variables (for custom and gpl3 licenses).
* Adding ability to specify no license.
* Adding custom license example to README.
2016-04-27 12:03:26 -04:00
Austin Riendeau
e21e5f0b09 updates readme to Explain SilenceErrors and SilenceUsage #225 2016-02-18 13:57:07 -07:00
Steve Francia
bbdcadf158 Add Swarm to Cobra user list 2016-02-08 17:02:59 -05:00
bogem
64cc91ac9b Fix typo in README 2016-02-06 17:38:32 +01:00
Matt McCoy
d12e2412b6 Fix links to markdown and man page docs 2016-01-13 21:40:50 -05:00
Gyu-Ho Lee
2a426b5c59 README: add etcd 2016-01-06 16:54:07 -05:00
Steve Domino
f3aca0a8e7 adding nanobox/nanopack to list of cobra users 2015-12-24 08:54:09 -05:00
Tony Hsu
ebd5d2bdca Update README.md 2015-12-09 15:48:54 +08:00
Tony Hsu
83de5c46ff Fix wrong command name. 2015-12-08 17:17:31 +08:00
Steve Francia
e22a0c9315 Better instructions for the execute inside main() 2015-11-20 17:37:40 -05:00
Anthony Fok
4e18e0c2bf Fix typos in README.md: Change "it's" to "its" where appropriate 2015-11-20 15:31:48 -07:00
Steve Francia
ec63835b77 Add install instructions for the cobra binary (and library) 2015-11-20 09:55:10 -05:00
spf13
6c0cb34745 Restructure README.md 2015-11-19 08:34:15 -05:00
Anthony Fok
9324f3657d Copyedit README.md 2015-11-15 00:28:22 -07:00
Greg Osuri
6efbf0b624 README: added cmdns extension 2015-11-09 11:49:37 -05:00
Austin Riendeau
8208714c1b adds accidental removal of section back 2015-11-09 11:48:59 -05:00
Austin Riendeau
d4c0084f5d changes README to have go code ran through gofmt 2015-11-09 11:48:59 -05:00
Austin Riendeau
bc980b80a1 adds alternative error handling to readme 2015-11-06 08:44:35 -05:00
Jonathan Boulle
5c3dc12a87 README: correct name of rkt project 2015-11-06 08:42:26 -05:00
Eric Paris
57c62d3180 Merge pull request #173 from jojomi/master
Update README.md
2015-11-03 15:29:33 -05:00
Steve Francia
a22f212832 Add clearer demo gif 2015-11-03 10:07:00 -05:00
Steve Francia
4f44cb7a62 Add demo gif to readme 2015-11-02 10:55:33 -05:00
Steve Francia
ae5c01791c Add logo to readme 2015-11-02 10:53:04 -05:00
jojomi
5fa86d5a21 Update README.md
Fixed typos with `Persistent`
2015-10-30 22:01:50 +01:00
Tamir Duberstein
e6d130ddfc README: fix CockroachDB typo 2015-10-29 15:31:43 -04:00
Steve Francia
2ab15e2b40 Add popular users and feature list to readme 2015-10-29 13:14:06 -04:00
Fabiano Franz
a83a172122 Improve suggestions - add explicit SuggestFor attribute 2015-09-25 12:07:38 -03:00
Fabiano Franz
b4087da7eb Allows command suggestions along with "unknown command" errors 2015-09-13 23:35:10 -03:00
Eric Paris
9e7788657f Auto generation of a man page 2015-08-21 01:10:13 -07:00
Scott Konzem
39e648c2b0 Fix typos in docs 2015-06-05 13:02:54 -04:00
Eric Paris
fad5931693 Add docs, tests, and bit of rearrainging... 2015-04-30 14:08:47 -04:00
Sam Boyer
476e73f093 Fix misspelling typo 2015-04-26 08:53:29 -04:00
kballou
f491ee284b Fix minor wording issue in README 2015-04-16 15:15:33 -06:00
Eric Paris
8a18f25809 Auto generation of markdown docs!
An example from the kubernetes project, for the `kubectl config`
command, which as subcommands, and flags, and all sorts of stuff, it
will generate markdown like so:

config modifies .kubeconfig files

config modifies .kubeconfig files using subcommands like "kubectl config set current-context my-context"

```
kubectl config SUBCOMMAND
```

```
      --envvar=false: use the .kubeconfig from $KUBECONFIG
      --global=false: use the .kubeconfig from /home/username
  -h, --help=false: help for config
      --kubeconfig="": use a particular .kubeconfig file
      --local=false: use the .kubeconfig in the current directory
```

```
      --alsologtostderr=false: log to standard error as well as files
      --api-version="": The API version to use when talking to the server
  -a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
      --certificate-authority="": Path to a cert. file for the certificate authority.
      --client-certificate="": Path to a client key file for TLS.
      --client-key="": Path to a client key file for TLS.
      --cluster="": The name of the kubeconfig cluster to use
      --context="": The name of the kubeconfig context to use
      --insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
      --log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
      --log_dir=: If non-empty, write log files in this directory
      --log_flush_frequency=5s: Maximum number of seconds between log flushes
      --logtostderr=true: log to standard error instead of files
      --match-server-version=false: Require server version to match client version
      --namespace="": If present, the namespace scope for this CLI request.
      --password="": Password for basic authentication to the API server.
  -s, --server="": The address and port of the Kubernetes API server
      --stderrthreshold=2: logs at or above this threshold go to stderr
      --token="": Bearer token for authentication to the API server.
      --user="": The name of the kubeconfig user to use
      --username="": Username for basic authentication to the API server.
      --v=0: log level for V logs
      --validate=false: If true, use a schema to validate the input before sending it
      --vmodule=: comma-separated list of pattern=N settings for file-filtered logging
```

* [kubectl](kubectl.md)	 - kubectl controls the Kubernetes cluster manager
* [kubectl config set](kubectl_config_set.md)	 - Sets an individual value in a .kubeconfig file
* [kubectl config set-cluster](kubectl_config_set-cluster.md)	 - Sets a cluster entry in .kubeconfig
* [kubectl config set-context](kubectl_config_set-context.md)	 - Sets a context entry in .kubeconfig
* [kubectl config set-credentials](kubectl_config_set-credentials.md)	 - Sets a user entry in .kubeconfig
* [kubectl config unset](kubectl_config_unset.md)	 - Unsets an individual value in a .kubeconfig file
* [kubectl config use-context](kubectl_config_use-context.md)	 - Sets the current-context in a .kubeconfig file
* [kubectl config view](kubectl_config_view.md)	 - displays merged .kubeconfig settings or a specified .kubeconfig file.
2015-04-12 14:40:34 -04:00
Eric Paris
c746d30ef0 Merge pull request #69 from eparis/command-annotations
Bash Autocompletion Generator
2015-04-10 23:20:17 -05:00
Peter Dave Hello
a40354f0bd Use svg instead of png to get better image quality 2015-04-10 07:15:21 +08:00
Eric Paris
9b2e6822e5 Add bash autocompletion generator
Given a (potentially annotated) cobra command you can generate a bash
completion script.
2015-04-07 20:13:49 -04:00
Étienne Vallette d'Osia
0e7e122c81 Add README section for RemoveCommand 2015-03-13 12:40:00 +09:00
Clayton Coleman
07a9dc0024 Update README.md to describe help behavior without subcommands 2015-02-11 17:18:36 -05:00
spf13
1cb31604a1 small formatting change to readme 2014-12-18 22:41:49 -05:00
Brad Dickason
d8ec18ee74 Fixed typo :D 2014-09-08 12:00:28 -04:00
Hugo Leonardo Costa e Silva
8d72c1e167 Fix typo mistake on README 2014-08-06 00:22:50 -04:00
spf13
10a8494a87 Support for flags before commands 2014-06-17 12:32:27 -04:00
spf13
07be8145cc Adding support for --help 2014-06-17 12:28:42 -04:00
Alan Pearce
7ab4fd75e9 Fix grammar in readme 2014-05-27 14:54:43 -04:00
Ryan Cox
0330aef05c Fix small typo 2014-05-09 23:30:45 -04:00
Brandon Philips
2d10990d9e fix(README): simple grammar fixup 2014-01-11 21:34:06 -08:00
Steve Francia
88d4f7089f Merge pull request #5 from mcuadros/master
Fixes in example
2014-01-02 09:56:32 -08:00
Bitdeli Chef
d7f66b2f69 Add a Bitdeli badge to README 2014-01-02 17:58:43 +00:00
Máximo Cuadros
1378a36255 Fixes in example 2013-12-21 11:32:14 +01:00
spf13
7216b06e83 Rewrote readme 2013-11-05 12:50:11 -05:00