Commit Graph

326 Commits

Author SHA1 Message Date
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
Anthony Fok 3bd84ba55c Ensure man page title is uppercase and has rootcmd
As described in http://man7.org/linux/man-pages/man7/man-pages.7.html
2015-11-21 06:13:53 -07:00
Anthony Fok baf44a3923 Fix Lintian warning: manpage-has-bad-whatis-entry
This patch fixes the problem where lexgrog fails to parse the NAME section
when the provided command contains space, e.g. "rootcmd subcmd".

Explanation from Lintian:

 Each manual page should start with a "NAME" section, which lists the
 name and a brief description of the page separated by "\-".  The "NAME"
 section is parsed by lexgrog and used to generate a database that's
 queried by commands like apropos and whatis.  This tag indicates that
 lexgrog was unable to parse the NAME section of this manual page.

 For manual pages that document multiple programs, functions, files, or
 other things, the part before "\-" should list each separated by a comma
 and a space.  Each thing listed must not contain spaces; a man page for a
 two-part command like "fs listacl" must use something like "fs_listacl"
 in the "NAME" section so that it can be parsed by lexgrog.

Ref: lexgrog(1), groff_man(7), groff_mdoc(7)
2015-11-21 06:12:14 -07:00
Anthony Fok 46c720088b Fix a copy-and-paste error in man_docs.md
Thanks to @goern for reporting the error.

Fixes #188
2015-11-20 17:12:30 -07:00
Anthony Fok 0cc7cc2c06 Fix typo in cobra/cmd/init.go 2015-11-20 15:50:06 -07: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
Anthony Fok 1e63ad8ed1 Fine-tune the formatting of Cobra’s generated code 2015-11-20 15:28:40 -07:00
Anthony Fok c7feee9f20 Add .mailcap for a more tidy "git shortlog" output 2015-11-20 15:24:23 -07:00
Anthony Fok 1f03277811 Fix minor typos in cobra_test.go 2015-11-20 15:23:16 -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
Eric Paris cb63a06ed9 Merge pull request #192 from apriendeau/executeC
Creates the ExecuteC function while maintaining Execute signature
2015-11-18 17:09:54 -05:00
Austin Riendeau 3f605993a9 Creates the ExecuteC function while maintaining Execute signature 2015-11-17 13:01:58 -07:00
Anthony Fok 9324f3657d Copyedit README.md 2015-11-15 00:28:22 -07:00
Bjørn Erik Pedersen f06ae19d96 Revert "Correct Go release version in Travis config (1.5.2)"
This reverts commit 1e1d5137bf.

There is no 1.5.2 ... No idea where I got that impression!?
2015-11-14 17:01:30 +01: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
Bjørn Erik Pedersen 1e1d5137bf Correct Go release version in Travis config (1.5.2) 2015-11-08 21:29:02 +01:00