Commit graph

150 commits

Author SHA1 Message Date
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
jharshman
642c3c7a0e vgo - compare generated files against golden files 2019-06-07 10:31:03 -04:00
jharshman
e993d53002 vgo - take named directory or current wd 2019-06-07 10:31:03 -04:00
jharshman
04af6aed80 vgo - add todo 2019-06-07 10:31:03 -04:00
jharshman
c3b51f3a2e simplify test 2019-06-07 10:31:03 -04:00
jharshman
4c22a20fd4 vgo - remove unused methods 2019-06-07 10:31:03 -04:00
jharshman
73b5215dc7 vgo - fix format 2019-06-07 10:31:03 -04:00
jharshman
44c2d482f6 fix calling to createLicenseFile 2019-06-07 10:31:03 -04:00
jharshman
91dbcb7ffe remove commented code 2019-06-07 10:31:03 -04:00
jharshman
5b1685faaa vgo - generate license 2019-06-07 10:31:03 -04:00
jharshman
abab9aa52a vgo - add Create method to Project struct 2019-06-07 10:31:03 -04:00
jharshman
69420a9ffa vgo - create directory 2019-06-07 10:31:03 -04:00
jharshman
17dc9f8142 fixing up templates more 2019-06-07 10:31:03 -04:00
jharshman
26d210e2cd vgo - fixing up the root template 2019-06-07 10:31:03 -04:00
jharshman
80ea2901b6 vgo-support - re-working code generator 2019-06-07 10:31:03 -04:00
umarcor
5755ecf102 [TrivialPatches] Typos in README.md, fix and update CI, update projects list... (#840)
* update Example in README.md (#769)

* specify the color as the required arg (#777)

* command: fix typo in docstring of InheritedFlags (#779)

* add istio to the list of projects built with Cobra (#786)

* remove redundant 'else' (#806)

* add mattermost-server as a project built with Cobra (#824)

* update README.md (#826)

Fix the comment: consistent with others

* add uber/prototool as a project built with Cobra (#831)

* fix(ci): use go vet, update to Go 1.12, update shellcheck to v0.4.6 (#832)

* add go.mod and go.sum (#833)

* chore(travis): move 'diff' job to separate stage in Travis (#839)

* chore(travis): use language configuration list instead of explicit entries in matrix.include (#839)

* chore(travis): update shellcheck-docker to v0.6.0 (#839)

* update(README.md): separate projects by commas, instead of using a list

* chore: update viper to v1.3.2 and go-md2man to v1.0.10

* fix: convert CRLF to LF when comparing files

* use kyoh86/richgo to provide colored test outputs
2019-03-20 17:21:26 -04:00
Rajat Jindal
615425954c remove dot after the abs path (#672) 2018-04-12 08:08:29 -04:00
Albert Nigmatzianov
0c34d16c31
cmd: Fix #612 (#614)
If user has a project in symlink, just use its destination folder and
work there.
2018-01-15 17:09:33 +01:00
Patrick Uiterwijk
b95ab734e2 Remove trailing whitespace in rootcmd (#606)
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
2017-12-31 15:15:56 +05:00
Nick Miyake
1be1d2841c Make rootCmd private
Update Cobra generator to make rootCmd private rather than
exporting it. Also update examples in README to use the exported
Execute() command rather than referencing unexported rootCmd.

Fixes #556
2017-11-23 08:13:30 +01:00
Clayton Ray
50204810fd Grammar addition (#543)
Just added a comma. Read weird without it
2017-10-09 08:28:07 +02:00
Albert Nigmatzianov
e8e7fe0355 Shorten README
Fix #501
2017-10-06 12:20:24 +02:00
Albert Nigmatzianov
d5bde60e02 cmd: Fix text of custom license
Fix #540
2017-10-04 22:36:42 +02:00
Elliott Beach
e5f66de850 Support default value of $GOPATH (#532)
Add support for go1.8 of blank $GOPATH
2017-09-29 18:16:12 +02:00
Tom Elliott
cb731b8983 Specify that parent's name is a variable for clarity. #514 2017-08-15 11:22:12 +05:00
Anthony Fok
b26b538f69 Fix remaining reproducibility in TestGoldenAddCmd
My previous fix in PR #504 was incomplete.

Fixes #503
2017-07-31 11:04:27 -06:00
Albert Nigmatzianov
3da102d464 cmd: Fix golden tests if user has config at $HOME
Fix #505
2017-07-31 06:38:19 -06:00
Albert Nigmatzianov
99838a52fe cmd: Small fixes 2017-07-31 06:38:19 -06:00
Anthony Fok
9e024b655b cmd: Refine formatting of included licenses 2017-07-30 02:35:06 -06:00
Anthony Fok
a1b7d3cc4d cmd: Add a blank line between copyright and license 2017-07-30 02:15:55 -06:00
Anthony Fok
75c6acfc8f cmd: Add "-u" to output unified diff in golden tests 2017-07-30 02:11:56 -06:00
Anthony Fok
cb9cf94690 Restore the use of cobra.OnInitialize in cobra executable
Without cobra.OnInitialize, cobra does not see the --config
command-line option and always tries to load $HOME/.cobra.yaml
instead.
2017-07-30 01:19:17 -06:00
Anthony Fok
750ba8ac93 Fix reproducibility in TestGolden{Add,Init}Cmd
These tests were time-dependent and would start failing in 2018
when the golden files still have the copyright year of 2017.

Fix by hard-coding the year 2017 for the purpose of these two tests
to ensure reproducible builds.

Fixes #503
2017-07-30 00:17:45 -06:00
Anthony Fok
161584fc2e Fix minor typos: "Know" → "Known" 2017-07-29 22:49:33 -06:00
Albert Nigmatzianov
715f41bd7a cmd: Ignore hidden files in isEmpty 2017-07-18 18:22:37 +02:00
Johanan Liebermann
31694f19ad Add missing 'and' in comment 2017-06-21 19:32:59 +02:00
Albert Nigmatzianov
b4dbd37a01 cmd: Fix tests 2017-06-12 08:36:10 +02:00
Albert Nigmatzianov
defa97f560 cmd: Fix output root.go of init with --viper=false
Fix #462
2017-06-12 08:23:33 +02:00
Albert Nigmatzianov
99ff9334bd cmd: Add possibility to specify the target package
Fix #455
2017-06-07 08:07:48 +02:00
Albert Nigmatzianov
4a1a7b086e cmd: Don't print errors from execute to prevent duplication of errors 2017-05-28 12:26:28 +02:00
Albert Nigmatzianov
c446db21d3 cmd: Delete projectBase flag
It's redundant and it didn't work earlier anyway.
2017-05-28 12:25:51 +02:00
Albert Nigmatzianov
4cdb38c072 cmd: Use correct HasPrefix function for paths
Updates #448
2017-05-15 09:51:20 +02:00
Albert Nigmatzianov
e9078fccb8 cmd: Make more accurate error when there is no $GOPATH 2017-05-15 09:20:36 +02:00
Albert Nigmatzianov
fa9ac853ce cmd: Make detailed error when project not in $GOPATH
Updates #448
2017-05-15 08:37:15 +02:00
Albert Nigmatzianov
b5366273a6 cmd: Fix some gometalinter complaints 2017-05-14 12:27:15 +02:00
Albert Nigmatzianov
d9414968f8 cmd: Fix error message from go-homedir 2017-05-14 12:03:16 +02:00
Behrang Noruzi Niya
a28055bed2 cmd: Fix minor bugs in init command (#446) 2017-05-14 12:00:53 +02:00
Albert Nigmatzianov
3454e0e28e cmd: Fix package name when adding command 2017-05-12 12:10:33 +02:00
Albert Nigmatzianov
e97db2b866 cmd: Fix tests 2017-05-09 11:15:48 +02:00
Albert Nigmatzianov
3dc7f13b65 cmd: Fix docs 2017-05-09 11:14:33 +02:00
Albert Nigmatzianov
d236d29810 cmd: Make tmpl local variable
Fix CircleCI tests
2017-05-08 23:00:14 +02:00
Albert Nigmatzianov
db6b9a8b3f cmd: Fix incorrect initialzation by cobra init .
Close #314
2017-05-05 10:51:57 +02:00
Albert Nigmatzianov
7bd35d3b95 cmd: Fix incorrect cmd dir 2017-05-05 10:35:27 +02:00
Albert Nigmatzianov
7bb5276f5f cmd: Fix panic if cmd ends on dash or underscore 2017-05-05 10:35:27 +02:00
Albert Nigmatzianov
efbe9b05d8 cmd: Use Fatalf instead of Fatal 2017-05-05 10:35:27 +02:00
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
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
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
Mark D. Blackwell
0a4540b161 Refactor licenses to many files (#323) 2017-04-20 17:34:10 +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
Ian Walter
9a8186dbb5 Improving createLicenseFile function
Also fixing typo in README example.
2016-04-27 12:03:26 -04:00
Ian Walter
d811f40c6a Adding custom license functionality
* Refactoring code that unnecessarily declares a map before making it.
* Cleaning up gpl3 formatting to match other licenses.
* Adding functionality that allows specifying custom license header
  and text in cobra config.
* Using license header and text as templates so that they can use
  template variables (for custom and gpl3 licenses).
* Adding ability to specify no license.
* Adding custom license example to README.
2016-04-27 12:03:26 -04:00
Rob Terhaar
3dc021e8c7 add gpl2 license 2016-04-27 12:01:30 -04:00
Rob Terhaar
8bf317ef60 add gpl2 license 2016-04-27 12:01:30 -04:00
Kevin Kirsche
3e71c61197 Update init per golint
X-Ref: #258
2016-04-01 21:29:12 -04:00
Ian Walter
a0bd6c17b3 Fixing golint warnings
* Moving final return outside of if-else
* Removing type declarations that Go can infer from values
* Cleaning up some existing comments
* Changing snake_case variables to camelCase
2016-03-31 09:53:34 -04: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
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
Sobit Akhmedov
9e39e41fb0 fix typo 2015-11-24 14:46:13 +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
0cc7cc2c06 Fix typo in cobra/cmd/init.go 2015-11-20 15:50:06 -07:00
Anthony Fok
1e63ad8ed1 Fine-tune the formatting of Cobra’s generated code 2015-11-20 15:28:40 -07:00
spf13
2a6ed7a106 utilize filepath.Join liberally
fixes #176
2015-11-06 11:08:12 -05:00
spf13
1d9d665f6f improving project path guessing 2015-11-06 10:44:59 -05:00
spf13
9bd7cfaa66 Fix bug where project name isn't properly detected 2015-10-31 22:04:55 -04:00
spf13
8377361429 Add extra feedback on successful initialization 2015-10-28 13:45:33 -04:00
spf13
4f2eaa858f removing some extra prints 2015-10-28 13:45:08 -04:00
spf13
a7defd47ef add add command functionality to cobra 2015-10-28 13:43:58 -04:00
spf13
ea5bc31ac4 Add cobra generator application 2015-10-28 12:51:48 -04:00