Commit Graph

896 Commits

Author SHA1 Message Date
Albert Nigmatzianov 76a9a66775 cmd: Add tests 2017-05-05 10:35:27 +02:00
Albert Nigmatzianov d20925b932 cmd: Small correctives 2017-05-05 10:35:27 +02:00
Albert Nigmatzianov 84cba621a0 cmd: Make detection of $HOME work on all systems
Use github.com/mitchellh/go-homedir

Fix #430
2017-05-05 10:35:27 +02:00
Albert Nigmatzianov 6bcf163261 cmd: Validate cmd names
Fix #269
2017-05-05 10:35:27 +02:00
Albert Nigmatzianov 903e5b7073 cmd: Fix trimSrcPath doc 2017-05-05 10:35:27 +02:00
Albert Nigmatzianov 66cfd1f132 cmd: Reuse template in helpers 2017-05-05 10:35:27 +02:00
Albert Nigmatzianov 0dd1c429a3 cmd: Add more docs 2017-05-05 10:35:27 +02:00
Albert Nigmatzianov 32756eb440 cmd: Rewrite 2017-05-05 10:35:27 +02:00
Albert Nigmatzianov 4061f41c9a Use pflag.ShorthandLookup 2017-05-05 08:08:38 +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
Albert Nigmatzianov 6f647b1711 Update .travis.yml
Delete obsolete versions and update Go 1.8 to Go 1.8.1
2017-05-01 22:56:13 +02:00
Angel Beltran bc8a58ff4d docs: Update README.md 2017-05-01 16:51:43 +02:00
Albert Nigmatzianov 7b1b6e8dc0 cmd: Edit license texts 2017-04-27 20:09:18 +02:00
Albert Nigmatzianov e2f2121008 cmd: Use 'this program' instead of appName in licenses 2017-04-27 20:09:18 +02:00
Albert Nigmatzianov 3d7bff8a32 Revert "Get rid of flagErrorBuf (#417)"
This reverts commit b655df6ce8.

Reason for revert: duplicate errors from flag. More in #426

Fix #426
2017-04-27 15:10:57 +02:00
Albert Nigmatzianov 6dd90846ba doc: Use w.Write instead of fmt in yaml_docs
benchmark                        old ns/op     new ns/op     delta
BenchmarkGenYamlToFile-4         62488         61622         -1.39%

benchmark                        old allocs     new allocs     delta
BenchmarkGenYamlToFile-4         121            120            -0.83%

benchmark                        old bytes     new bytes     delta
BenchmarkGenYamlToFile-4         26706         26280         -1.60%
2017-04-26 21:30:17 +02:00
Albert Nigmatzianov 97af803f3b doc: Cleanup md_docs
Performance gain:
benchmark                        old ns/op     new ns/op     delta
BenchmarkGenMarkdownToFile-4     23096         10295         -55.43%

benchmark                        old allocs     new allocs     delta
BenchmarkGenMarkdownToFile-4     47             48             +2.13%

benchmark                        old bytes     new bytes     delta
BenchmarkGenMarkdownToFile-4     1984          2832          +42.74%
2017-04-26 21:30:17 +02:00
Albert Nigmatzianov de484eefb4 doc: Refactor man docs
Performance impact (very strange):
benchmark                        old ns/op     new ns/op     delta
BenchmarkGenManToFile-4          30037         29001         -3.45%

benchmark                        old allocs     new allocs     delta
BenchmarkGenManToFile-4          77             89             +15.58%

benchmark                        old bytes     new bytes     delta
BenchmarkGenManToFile-4          9075          9651          +6.35%
2017-04-26 21:30:17 +02:00
Albert Nigmatzianov ea3c5beeff Add TestHelpFlagInHelp 2017-04-26 21:24:14 +02:00
Albert Nigmatzianov 867d414548 Initialize help flag in initHelpCmd
Fix #302
2017-04-26 21:24:14 +02:00
Albert Nigmatzianov 6ed17b5128 cmd: Add more possible matches for bsd licenses 2017-04-25 18:44:42 +02:00
Albert Nigmatzianov c68a90d2e8 Add built-in licenses info to README 2017-04-25 18:25:29 +02:00
Albert Nigmatzianov 164be37318 cmd: Add AGPL license
See #318
2017-04-25 18:25:29 +02:00
Albert Nigmatzianov 1efd89226b cmd: Add LGPL license
See #311, #318
2017-04-25 18:25:29 +02:00
Albert Nigmatzianov 6d4267ffb7 cmd: Delete redundant symbols from helpers_test.go and licenses.go 2017-04-25 18:25:29 +02:00
Albert Nigmatzianov 78a8032244 cmd: Move some license functions from helpers.go to licenses.go 2017-04-25 18:25:29 +02:00
Albert Nigmatzianov 28fe9aaa16 cmd: Fix GPL 3 License header
See #311
2017-04-25 18:25:29 +02:00
Albert Nigmatzianov 47029cc60a cmd: Delete extra whitespace from GPL 3 License header
Fix #322
2017-04-25 18:25:29 +02:00
Albert Nigmatzianov f4f10f6873 Simplify stripFlags 2017-04-24 15:20:01 +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
Albert Nigmatzianov 9890b7b2e9 Simplify stripFlags function 2017-04-23 22:42:38 +02:00
Andrey Kurilin aea94819d2 Fix typo at docstring for HasHelpSubCommands (#309)
s/avilable/available
2017-04-23 22:29:41 +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 681a777b18 Delete checkHelpFunc 2017-04-23 09:17:44 +02:00
Albert Nigmatzianov 10f6b9d7e1 Make `go path bin` clearer in README
Fix #324
2017-04-20 21:54:12 +02:00
Mark D. Blackwell 0a4540b161 Refactor licenses to many files (#323) 2017-04-20 17:34:10 +02:00
Albert Nigmatzianov f58a8d6bd3 Add TestSortedFlags 2017-04-20 15:38:50 +02:00
Albert Nigmatzianov e135867f96 Make parentsPflags more flexible
updateParentsPflags returns nothing, so you can use it independent of
mergePersistentFlags. A little performance impact.
2017-04-20 15:38:50 +02:00
Albert Nigmatzianov 3e61377cd5 Use AddFlagSet instead of self-written function 2017-04-20 15:38:50 +02:00
Albert Nigmatzianov 458d79748e Add merging of CommandLine flags to Root command 2017-04-20 15:38:50 +02:00
Albert Nigmatzianov 37a4355faa Fix tests 2017-04-20 15:38:50 +02:00
Albert Nigmatzianov 3d89ed4908 Add only missing persistent flags of parents in mergePersistentFlags
As persistent flags of parents can only be added, we don't need to always
check them every time, so make updateParentsPflags return only added flags.

Performance improvement:
benchmark                     old ns/op     new ns/op     delta
BenchmarkInheritedFlags-4     5595          4412          -21.14%
BenchmarkLocalFlags-4         3235          2667          -17.56%

benchmark                     old allocs     new allocs     delta
BenchmarkInheritedFlags-4     39             24             -38.46%
BenchmarkLocalFlags-4         21             15             -28.57%

benchmark                     old bytes     new bytes     delta
BenchmarkInheritedFlags-4     1000          600           -40.00%
BenchmarkLocalFlags-4         544           408           -25.00%
2017-04-20 15:38:50 +02:00
Albert Nigmatzianov 6202b5942b Refactor flags mechanisms
I think It's more obvious now to understand the inheritance of flags.

Fix #403
Fix #404

Performance improvements:
benchmark                     old ns/op     new ns/op     delta
BenchmarkInheritedFlags-4     6536          5595          -14.40%
BenchmarkLocalFlags-4         3193          3235          +1.32%

benchmark                     old allocs     new allocs     delta
BenchmarkInheritedFlags-4     49             39             -20.41%
BenchmarkLocalFlags-4         23             21             -8.70%

benchmark                     old bytes     new bytes     delta
BenchmarkInheritedFlags-4     2040          1000          -50.98%
BenchmarkLocalFlags-4         1008          544           -46.03%
2017-04-20 15:38:50 +02:00
Elliot Morrison-Reed a3cd8ab85a Use os.Getenv("HOME") instead of "$HOME" for windows compatibility (#337) 2017-04-20 15:35:06 +02:00
Albert Nigmatzianov b655df6ce8 Get rid of flagErrorBuf (#417)
Fix #27
2017-04-19 09:23:43 -04:00
Albert Nigmatzianov f95d58bdf3 Fix #401 (#402)
* doc: Add and edit docs

* doc: Add tests
2017-04-19 14:39:58 +02:00
Théotime Lévêque b6cb395893 Fix typo in docstring (#360) 2017-04-17 19:03:07 +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