Commit Graph

545 Commits

Author SHA1 Message Date
Jonathan Reyna 1ef0913976 Use nil instead of len for arg check.
This honors the SetArgs() call
2016-02-08 17:04:25 -05:00
Steve Francia bbdcadf158 Add Swarm to Cobra user list 2016-02-08 17:02:59 -05:00
Eric Paris 04d02e3184 Merge pull request #241 from bogem/typo
Fix typo in README
2016-02-06 12:39:43 -05:00
bogem 64cc91ac9b Fix typo in README 2016-02-06 17:38:32 +01:00
Anthony Fok 801364aa15 Skip "bash: declare: -A: invalid option" error gracefully
The use of "declare -A flaghash" (associative array) was introduced
in PR #205, which works perfectly for Bash 4.x, but OS X insists on
shipping a very outdated Bash 3.2.x.

This patch hides the "bash: declare: -A: invalid option" error message
and allows the bash completion script to continue gracefully on
OS X, albeit without the benefit of the new feature in PR #205.

Fixes #240
2016-02-05 13:04:36 +08:00
Garth Kidd 57f473263e Add explicit doc.GenMan SEE ALSO test covering #229 2016-01-21 12:12:26 +11:00
Garth Kidd cb8496d6b2 Ensure SEE ALSO list has no leading comma, fixing #229 2016-01-21 12:11:56 +11:00
Eric Paris 8e91712f17 Merge pull request #228 from garthk/fix-doc-generation
Fix doc generation and its documentation
2016-01-16 22:09:38 -05:00
Garth Kidd 356750645f Update doc generation examples. Fixes #227. 2016-01-17 11:29:42 +11:00
Garth Kidd 8e6aca4182 Use filepath.Join, not string math. Fixes #226. 2016-01-17 11:25:20 +11:00
Eric Paris 9c93009019 Merge pull request #223 from mattnenterprise/doc-link-fixes
Fix links to markdown and man page docs
2016-01-13 22:06:19 -05:00
Matt McCoy d12e2412b6 Fix links to markdown and man page docs 2016-01-13 21:40:50 -05:00
Anthony Fok 97f831a4fd Change first line of generated bash-completion file
to conform with existing bash-completion snippets and
to suppress Lintian "script-not-executable".
2016-01-11 15:37:32 -07:00
Gyu-Ho Lee 2a426b5c59 README: add etcd 2016-01-06 16:54:07 -05:00
Eric Paris a3a9f345ca Merge pull request #218 from mvdan/error-checking
Error checking for doc generation
2016-01-06 09:57:15 -05:00
Daniel Martí 5df1341f93 Treat write errors in man doc generation
Just like the last commit, but now for manpages.

genMan still works with a buffer and returns []byte instead of working
directly with an io.Writer. This is because, in turn, md2man takes byte
slices instead of readers and writers.

Wrapping genMan around a writer is unnecessary especially since it's not
an exported function, and also because we'd still need a buffer to get
the output bytes.
2016-01-06 12:25:27 +01:00
Daniel Martí eb5040e69e Treat write errors in markdown doc generation
This code was already using io.Writer, but was completely ignoring write
errors.

The most worrying part is how GenMarkdownTreeCustom used an unnecessary
buffer to then dump all of its contents on a file, and instead of
returning an error on file creation/writing, it would just exit the
entire program.
2016-01-06 12:21:04 +01:00
Daniel Martí ea06b29c10 Simplify GenMarkdownTreeCustom signature 2016-01-06 11:59:08 +01:00
Daniel Martí 5fa1003a36 Remove unused outs global var 2016-01-06 11:49:16 +01:00
Eric Paris c82a0ceef8 Merge pull request #215 from mvdan/interfacer
Replace *bytes.Buffer with io.Writer
2016-01-05 16:50:52 -05:00
Daniel Martí e0479ff7a7 Add error handling to GenBashCompletion
Since the switch from *bytes.Buffer to io.Writer, errors can no longer
be ignored. Also makes the reuse of GenBashCompletion in
GenBashCompletionFile without a buffer treat errors properly again.
2016-01-05 21:31:19 +01:00
Daniel Martí a5ff2f28ab Reuse GenBashCompletion in GenBashCompletionFile 2016-01-05 21:30:42 +01:00
Daniel Martí 463be1428d Replace *bytes.Buffer with io.Writer
Also adds support for generating bash completions on writers other than
just buffers.

Found via github.com/mvdan/interfacer.
2016-01-05 21:30:42 +01:00
Tamer TAS c6399cd398 Use readline's default filename completion if completion fails
If the `compspec` generates no matches it uses bash filename completion instead.
2016-01-02 08:11:35 +02:00
Frank Schroeder b3f29e98e6 Issue #195: Move doc generation into separate pkg
* Move man_docs and md_docs into new doc pkg
* Replace *bytes.Buffer with io.Writer
* Replace c == cmd.helpCommand with c.IsHelpCommand()
* Remove redundant len(children) == 0 check in HasSeeAlso
* Duplicate test setup for doc generation
2015-12-24 09:01:59 -05:00
Steve Domino f3aca0a8e7 adding nanobox/nanopack to list of cobra users 2015-12-24 08:54:09 -05:00
Kenjiro Nakayama 60b8213eba Add flaghash to bash_completion to keep flag value 2015-12-24 08:53:30 -05:00
Sascha Holzleiter 2bd8a730ae always show help if requested, even if SilenceErrors is enabled 2015-12-24 08:52:49 -05:00
Anthony Fok c65e6422ff Fix typo: exiting → existing 2015-12-17 14:43:23 -07:00
Anthony Fok c3ef89ad8a Fix typo: initalize → initialize, etc.
Detected by Debian’s Lintian tool
2015-12-17 11:18:55 -07:00
Eric Paris 73665614cb Merge pull request #197 from magiconair/issue-195-mousetrap-win-only
Issue #195: Compile mousetrap only on Windows
2015-12-16 19:04:05 -05:00
Eric Paris 11265d64db Merge pull request #210 from boz/colon-completion
Bash completion for names with ':' character.
2015-12-16 17:12:45 -05:00
Eric Paris ea3bf167cf Merge pull request #211 from NanXiao/patch-1
Update command.go
2015-12-16 10:02:01 -05:00
Nan Xiao d95d1b86bb Update command.go
Fix typo in AddCommand method.
2015-12-16 16:14:10 +08:00
Jared Bydeley ee6224d01f Ugly fix for filepath.IsAbs not playing nicely with windows 2015-12-11 15:44:48 -05:00
Jared Bydeley 1f27c09535 Fixed tests for how they are run 2015-12-11 15:44:48 -05:00
Jared Bydeley 3e7fb991e1 Fixed import path issue on Windows 2015-12-11 15:44:48 -05:00
Adam Bozanich fe79245d1a Bash completion for names with ':' character. 2015-12-09 20:57:45 -08:00
Eric Paris 29cddf65b2 Merge pull request #208 from gosharplite/patch-2
Update four to three
2015-12-09 08:50:41 -05:00
Tony Hsu ebd5d2bdca Update README.md 2015-12-09 15:48:54 +08:00
Eric Paris 8210022f43 Merge pull request #207 from gosharplite/patch-1
Fix wrong command name.
2015-12-08 10:13:42 -05:00
Tony Hsu 83de5c46ff Fix wrong command name. 2015-12-08 17:17:31 +08:00
Eric Paris 1c44ec8d3f Merge pull request #200 from sobit/patch-1
fix typo
2015-11-24 10:32:17 -05:00
Sobit Akhmedov 9e39e41fb0 fix typo 2015-11-24 14:46:13 +01:00
Frank Schroeder 193b182195 Issue #195: Compile mousetrap only on Windows
* Create command_win.go and command_notwin.go for windows only code
* Move call to mousetrap hook into separate preExecHook() function
2015-11-24 01:52:16 +01:00
Christoph Görn b167d9beaa add GNU GPL3 as a license 2015-11-23 11:47:14 -07:00
Anthony Fok 4b096512f3 Reflow license text and add copyright year and name
* Format license text and header to fit within 80 characters per line
 * Remove extra top line from LICENSE file for Apache-2.0
 * Remove the FreeBSD-specific disclaimer from the BSD-2-Clause license
 * Use {{ .copyright }} to add "Copyright © YEAR FULL NAME" to the
   LICENSE file for MIT and BSD licenses.
2015-11-21 23:37:58 -07:00
Anthony Fok 6d6c92d5b7 Parse the full license text as a template
... to allow including "Copyright © 2015 NAME HERE" to the output
LICENSE file where necessary
2015-11-21 23:29:20 -07:00
Anthony Fok 10546a043b Remove extraneous comma at the end of SEE ALSO list 2015-11-21 06:23:56 -07:00
Anthony Fok 9c32fb42ec Reset man page title when necessary in GenManTree
If the user did not define header.Title when calling GenManTree(),
reset it after each call to GenMan(), otherwise the entire man page tree
would be stuck with the full command name that was calculated for the
first man page, leaving all subsequent man pages with an identical
but incorrect title.
2015-11-21 06:18:37 -07:00