Commit graph

863 commits

Author SHA1 Message Date
Sam Ghods
e0f326dabc Fix root command without subcommands but with arguments
[close #108]
2015-05-19 10:22:07 -04:00
Eric Paris
c11766b405 slight typo in md_docs.md 2015-05-13 08:38:33 -05:00
Bjørn Erik Pedersen
e659faf634 Merge pull request #109 from bep/markdowncustom
genmarkdown: add optional frontmatter- and linkadjustment-funcs
2015-05-13 15:30:04 +02:00
bep
1d99c8ff6d genmarkdown: add optional frontmatter- and linkadjustment-funcs
The automatic Markdown generator works great!

But to use it to render the documentation in Hugo, we need front matter and slightly different links.

This commit adds optional callback funcs to add that.
2015-05-13 15:22:00 +02:00
bep
be18870136 Fix two failing tests
The error message has changed ever so slightly.
2015-05-13 11:54:47 +02:00
Eric Paris
bba56042cf Merge pull request #105 from eparis/minor-bash-cleanup
make filename extension handling a bash function
2015-05-04 22:51:16 -05:00
Eric Paris
dff410ab56 make filename extension handling a bash function
We were trying to call a bash function with bash stuff like @ () from a
variable.  Stop that.  Just call a function with an arg from a variable
instead of trying to pass around the bash.

Should fix https://github.com/spf13/cobra/pull/103
2015-05-04 18:41:53 -04:00
Eric Paris
743fa31b46 Merge pull request #106 from eparis/bash-comp-docs
Make the filename extension bit of docs easier to read.
2015-05-04 15:20:46 -05:00
Eric Paris
48b95d0594 Make the filename extension bit of docs easier to read. 2015-05-04 16:20:06 -04:00
Eric Paris
787b737b48 Merge pull request #104 from eparis/minor-bash-cleanup
Clean up minor bash complaints from shellcheck.net
2015-05-04 13:56:05 -05:00
Eric Paris
f4b3401f9e Clean up minor bash complaints from shellcheck.net 2015-05-04 14:40:27 -04:00
Eric Paris
7fc9f148dd Merge pull request #102 from andronat/master
Fixed Persistent-Run function propagation
2015-05-04 11:57:28 -05:00
Anastasis Andronidis
799a8ef863 Test for Persistent-Run propagation 2015-05-04 17:57:46 +02:00
Anastasis Andronidis
42e6ce397f Fixed Persistent-Run function propagation 2015-05-04 03:42:55 +02:00
Eric Paris
3ee9552eeb Merge pull request #100 from eparis/pre-post-run
Pre post run fucntions
2015-04-30 13:26:01 -05:00
Eric Paris
fad5931693 Add docs, tests, and bit of rearrainging... 2015-04-30 14:08:47 -04:00
Alexander Thaller
fbce60cc56 added persistent pre/post commands. 2015-04-30 12:45:23 -04:00
Alexander Thaller
2df64026ba added pre and post run hooks. 2015-04-30 12:44:01 -04:00
Eric Paris
9cf0f3737d Merge pull request #90 from eparis/deprecated-subcommands
Deprecated subcommands
2015-04-30 10:22:48 -05:00
Eric Paris
7c7837e882 Merge pull request #85 from eparis/more-simplification
More simplification
2015-04-30 10:21:12 -05:00
Eric Paris
2d5fab043c Merge pull request #75 from eparis/CommandLine
Make flags declared outside spf13.pflag persistent flags on the parent
2015-04-30 10:20:35 -05:00
Eric Paris
c3e48f996d Deprecated subcommands
They should still work, but shouldn't show up in help or usage output
2015-04-29 13:08:20 -04:00
Eric Paris
69e5f196b5 Merge pull request #98 from eparis/markdown-quiet-test
quiet down to go test for markdown generation
2015-04-28 09:43:10 -05:00
Eric Paris
a112838e26 quiet down to go test for markdown generation
We were printing the markdown, don't ask me why.
2015-04-28 10:42:03 -04:00
Clayton Coleman
af6b555418 Merge pull request #95 from deads2k/deads-prevent-extra-removal
prevent removal of valid arguments
2015-04-28 10:06:27 -04:00
deads2k
36aee64abe prevent removal of valid arguments 2015-04-28 07:58:26 -04:00
Bjørn Erik Pedersen
ebb2d55f56 Merge pull request #97 from sdboyer/patch-1
Fix misspelling typo
2015-04-26 16:23:45 +02:00
Sam Boyer
476e73f093 Fix misspelling typo 2015-04-26 08:53:29 -04:00
Bjørn Erik Pedersen
d697cc29c1 Merge pull request #96 from commonlisp/master
Fixed typo in md output
2015-04-25 22:31:21 +02:00
George Kuan
c4667c9e63 Fixed typo in md output 2015-04-25 10:59:26 -07:00
Eric Paris
3c187e9045 Merge pull request #93 from kennyballou/minor_grammar_fix
Fix minor wording issue in README
2015-04-16 16:19:32 -05:00
kballou
f491ee284b Fix minor wording issue in README 2015-04-16 15:15:33 -06:00
Eric Paris
9cb5e85029 Merge pull request #92 from eparis/sort-valid-args
Sort the valid args before output
2015-04-13 17:59:01 -05:00
Eric Paris
0fc734c3c5 Sort the valid args before output
We do this so we get stable repeatable output and can see if updates are
necessary or if it is just golang doing the same thing twice differently
2015-04-13 18:44:05 -04:00
Eric Paris
c0da825198 Merge pull request #87 from eparis/gen-md-doc
Auto generation of markdown docs!
2015-04-12 13:45:33 -05: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
Eric Paris
9ea4cdf081 Merge pull request #91 from PeterDaveHello/patch-1
Use svg instead of png to get better image quality
2015-04-10 23:20:05 -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
a068307565 add a helper to annotate a flag as 'required' by a command 2015-04-07 20:14:18 -04: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
Eric Paris
b78326bb16 Merge pull request #88 from eparis/subhelptest
Add tests about additional help topics
2015-04-07 18:26:15 -05:00
Eric Paris
aab4e37189 Merge pull request #89 from eparis/line-in-go-test-error
print line number in go test failures
2015-04-07 17:05:46 -05:00
Eric Paris
86a16864ea Add tests about additional help topics 2015-04-07 16:17:22 -04:00
Eric Paris
9692856020 print line number in go test failures 2015-04-07 15:56:01 -04:00
Eric Paris
f576d29563 Merge pull request #82 from bep/mousetrap
Add mousetrap for Windows users
2015-04-06 15:49:03 -05:00
Eric Paris
0ea881ce45 Merge pull request #60 from dohzya/remove-command
Add Command's RemoveCommand method
2015-04-06 15:18:42 -05:00
Eric Paris
bbc51773c3 Merge pull request #77 from eparis/additional-help-topics
Additional help topics
2015-04-06 15:04:48 -05:00
Eric Paris
794a362808 Remove specail casing in Execute()
We had some stuff that created a new empty []string if args was already
and empty string (why?)

We had some stuff that called Help() if it wasn't runnable (but
.execute() already does that)

Just remove the special case stuff.
2015-04-06 16:02:09 -04:00
Eric Paris
b9e25fa4a0 Slight formatting change, to make next commit more readable 2015-04-06 16:02:08 -04:00