Commit graph

148 commits

Author SHA1 Message Date
John McBride 19c9c74384
Always include the os package import when generating the root command (#1557)
Signed-off-by: John McBride <jmcbride@vmware.com>
2021-12-09 14:47:27 -07:00
Unai Martinez-Corral 36bff0a4d5
fix root.go.golden (#1552) 2021-12-07 16:24:06 -07:00
ANGkeith 1beb476da9
fix: Duplicate error message from cobra init boilerplates (#1463) 2021-12-07 16:03:24 -07:00
darklore 25bab5a398
Fix invalid shell completion when used with ~/.cobra.yaml (#1510)
`cobra completion` outputs invalid output "Using config file:" at the
top of the completion script. when ~/.cobra.yaml exists.
2021-12-07 16:00:50 -07:00
Unai Martinez-Corral 62a72cdd0f
fix(diff): use arg '--strip-trailing-cr' (#949)
In tests with diff, ignores trailing carriage returns (so tests pass on windows)
2021-11-16 15:17:12 -07:00
Yann Soubeyrand 442031e4ff
Allow specifying licenses using their SPDX identifier (#1159) 2021-11-15 13:39:40 -07:00
Steve Winslow 78969f9c81
Remove "Lesser" from header for GPL-2.0 template (#880)
This removes "Lesser" from the GPL-2.0 header template, since that header is meant to be referring to GPL-2.0 and not LGPL-2.0.

Fixes #879 

Signed-off-by: Steve Winslow <swinslow@gmail.com>
2021-11-15 13:33:16 -07:00
Steve Francia bfacc59f62 Addressing typos identified by @marckhouzam 2021-11-03 15:36:51 -04:00
Steve Francia 26825627c2 Simplifying goGet function 2021-11-03 15:36:51 -04:00
Steve Francia cf87fc4e30 Updating generator documentation and links
Merging the updated documentation from the user_guide into the cobra/README.md.
Adding links as appropriate to both guides.
2021-11-03 15:36:51 -04:00
Steve Francia 9388e79fb4 Cobra generator now works within Go modules
Pretty major change in behavior, but with modules a change is needed.
Now cobra can initialize and add from within any Go module.
The experience is simplified and streamlined, but requires `go mod init` to happen first.
2021-11-03 15:36:51 -04:00
Steve Francia c9edb78acc Change generator default license to none
It's questionable that a default license makes any sense from a legal perspective.
If the tool created the license without the user choosing it, then it may not even be applicable.
Best to let the user choose their license with intent.
2021-11-03 15:36:51 -04:00
Steve Francia dcf42b25f7 Change generator to require opting in to viper.
Cobra and Viper are great together, but it's not uncommon to use them apart.
New Cobra users don't know better and including Viper by default adds complexity to the skeleton.
2021-11-03 15:36:51 -04:00
Steve Francia c0dd5cdef5 Removing unused imports when not using Viper 2021-11-03 15:36:51 -04:00
umarcor 8eaca5f0f4 drop mitchellh/go-homedir (#853) 2021-06-30 14:08:43 -04:00
Rob Playford 9a432671fd
fix home directory config not loading (#1282)
leverage `viper.SetConfigType("yaml")` to fix issue regarding home directory configuration failing to load.
2021-06-15 19:52:13 -06:00
tamo 4590150168
Correcting misspelled words (#1349)
* Correcting Misspelled Words
* grammar fixes
2021-05-10 17:19:33 -06:00
Unai Martinez-Corral 652c755d37
Use golangci-lint (#1044)
Use golangci-lint. Repair warnings and errors resulting from linting.
2021-02-07 17:08:50 -07:00
Maxime Bury 4384b91fb4
Bump license year to 2021 in golden files (#1309)
* Update main.go.golden

* Update root.go.golden

* Update test.go.golden
2021-01-16 20:41:43 -05:00
John McBride 0bc8bfbe59
Remove secondary go mod to prevent broken go get (#1233) 2020-09-23 16:26:21 -06:00
Danny Hermes 7f8e83d936
Modifying "snake-case" to "kebab-case" for clarity. (#1196) 2020-09-16 09:27:58 -06:00
Joshua Harshman 9ed1d713d6
bugfix/cli: Temporary fix for go get on cobra cli (#1200)
PR #1139 introduced a complexity that will have to be taken into account
as we figure out our release pipeline. This fix pins to cobrav1.0.0 as a
temporary workaround.

fixes: #1191
2020-08-23 13:45:41 -04:00
Michael Muré 81e0311edd
modules: add a secondary go.mod to segregate CLI dependencies (#1139) 2020-08-15 10:44:17 -04:00
Warren Fernandes 41fd44e1df
Fix cobra init cmd help documentation (#1108)
Adds tests for other cases where we do not expect projects to be created
for absolute paths and relative paths in GOPATH.
2020-04-28 16:59:18 -06:00
Warren Fernandes 44d55fb4d3
Fix cobra command README (#1106)
Describes the behavior of custom LICENSE generation using properties in
~/.cobra.yml
2020-04-28 11:49:46 -06:00
Amit Botzer 8c638d3f90
Fixed typo. (#1087)
Changed 'applicaton' to 'application'.
2020-04-10 15:30:10 -06:00
Kanji Yomoda f62883520e
Replace deprecated SetOutput func with SetOut and SetErr in test (#1053) 2020-04-01 10:25:22 -06:00
Joshua Harshman 39cf99f556
leverage makefile to run build tasks (#976)
remove circle ci
2020-02-20 12:25:38 -07:00
Nickolas Kraus 89c7ffb512 Bump year on golden files (#1010) 2020-01-06 11:10:57 -07:00
Joshua Harshman 447f182a9d
format tpl/main.go templates (#980) 2019-12-23 13:51:40 -07:00
umarcor 19cf35ea77 fix: ensure that testproject is removed even after a failure (#948)
* fix: ensure that testproject is removed even after a failure

* fix: defer licenseFile

* style: simply defer os.RemoveAll

* cobra/cmd: add getProject test func
2019-09-17 09:02:42 -06:00
Bruce Downs 993cc5372a Adjustments per PR review feedback from @bogem 2019-08-02 01:25:21 +05:00
Bruce Downs d85196337c Correct all complaints from goimports
* i.e.
* go get golang.org/x/tools/cmd/goimports
* goimports -w *.go
* goimports -w cobra/
2019-08-02 01:25:21 +05:00
Bruce Downs 51f06c7dd1 Correct all complaints from golint
* i.e.
* go get golang.org/x/lint/golint
* go list ./... | xargs golint
2019-08-02 01:25:21 +05:00
Bruce Downs 9552679939 Add idiomatic handling of go error in distinct main func 2019-08-02 01:25:21 +05:00
Joshua Harshman 1c9c46d5c1
Update Generator Docs to reflect changes brought in #817 (#904) 2019-07-24 10:10:51 -06:00
umarcor 2d7544ebde fix missing newline in cmd/add (#905) 2019-07-15 09:44:15 -06:00
Joshua Harshman 2411ac592a remove unused struct fields 2019-06-07 10:31:03 -04:00
jharshman 984374f5b6 clean up testproject files after test executes 2019-06-07 10:31:03 -04:00
jharshman 11aa612384 test add 2019-06-07 10:31:03 -04:00
jharshman 303a3e5160 vgo - strip out unused methods 2019-06-07 10:31:03 -04:00
jharshman 0bb1506d25 remove commented field in struct 2019-06-07 10:31:03 -04:00
jharshman 2fea75b02e vgo - add command working 2019-06-07 10:31:03 -04:00
jharshman 3c42f846c2 fix duplicated dir 2019-06-07 10:31:03 -04:00
jharshman 221bae3986 depricate package name flag 2019-06-07 10:31:03 -04:00
jharshman b8ad19ad0d reorder some operations 2019-06-07 10:31:03 -04:00
jharshman 732e4db0d4 vgo - trim some uneeded data from struct 2019-06-07 10:31:03 -04:00
jharshman c7ac101cf8 vgo - fixing up the add op to work with vgo 2019-06-07 10:31:03 -04:00
jharshman 3741457400 add CommandTemplate 2019-06-07 10:31:03 -04:00
jharshman 50665e9993 vgo - update golden templates 2019-06-07 10:31:03 -04:00