Commit graph

878 commits

Author SHA1 Message Date
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 c356c6491b add .idea/* to gitignore 2019-06-07 10:31:03 -04:00
jharshman 80ea2901b6 vgo-support - re-working code generator 2019-06-07 10:31:03 -04:00
Jan Kuehle d658160bdd Add markdown file explaining support for PowerShell 2019-06-07 10:26:08 -04:00
Jan Kuehle 21ccc7b307 Add basic PowerShell completions 2019-06-07 10:26:08 -04:00
Haim Ashkenazi e2c45ac9eb Started working on Unified API for the various shell completions:
- Moved some general function to a more generic shell_completions file.
- Added functions to mark flag as directory completion.
- Started making the global functions docs more generic (not bash
  specific) and added compatibility matrix.
2019-06-07 10:09:50 -04:00
Haim Ashkenazi 601d83077b typo in zsh-completions.md 2019-06-07 10:09:50 -04:00
Haim Ashkenazi edbb6712e2 zsh-completions: implemented argument completion. 2019-06-07 10:09:50 -04:00
Haim Ashkenazi d262154093 zsh-completion: tidy up function and variable names
There are many files in the package, renamed all zsh-completion
related names to convey that.
2019-06-07 10:09:50 -04:00
Haim Ashkenazi 8822449c0f zsh-completion: added escapinng of single quotes in flag description. 2019-06-07 10:09:50 -04:00
Haim Ashkenazi 66a98807d4 zsh-completion: test to verify that we're always running on root cmd. 2019-06-07 10:09:50 -04:00
Haim Ashkenazi 7b62c7df78 zsh-completion: --version and --help still doesn't work correctly
When invoking from subcommand. Modified the test to prove.
2019-06-07 10:09:50 -04:00
Haim Ashkenazi 7ce08e227e zsh-completion: completion should always parse the root command!
It was running on the command it was invoked from which caused some
additional helpers (--help, --version) not to be generated.
2019-06-07 10:09:50 -04:00
Haim Ashkenazi 91e80cc4a4 zsh-completion: remove bad test
I thought there was a bug in the boolSlice definition but it seems
It was my mistake in identifying what's going on. Also removed the
provisioning to skip tests (doesn't seem to be needed anymore).
2019-06-07 10:09:50 -04:00
Haim Ashkenazi 0d9a33d2da zsh-completion: remove temporary file
Yet another temporary file that found itself in the repo :(
2019-06-07 10:09:50 -04:00
Haim Ashkenazi 50f385938e zsh-completion: added support for filename globbing. 2019-06-07 10:09:50 -04:00
Haim Ashkenazi bda855a1a0 zsh-completions: fixed zsh completion markdown file name. 2019-06-07 10:09:50 -04:00
Haim Ashkenazi dd577bdf31 zsh-completion: added zsh-completion documentation. 2019-06-07 10:09:50 -04:00
Haim Ashkenazi 461a39d5b9 zsh-completion: removed forgotten function. 2019-06-07 10:09:50 -04:00
Haim Ashkenazi df12a0a249 zsh-completion: two fixes for identifying flag usage:
Fixed after input from @eparis:
- Decide on option parameter by checking NoOptDefVal
- Slices also could be specified multiple times.
2019-06-07 10:09:50 -04:00
Haim Ashkenazi e9ee8f0446 zsh-completion: removed the _dep_ files.
They were committed by mistake.
2019-06-07 10:09:50 -04:00
Haim Ashkenazi ec4b8c974c zsh-completions: revised flags completion rendering + new features:
- If the flags are not bool the completion expects argument.
- You don't have to specify file extensions for file completion to
  work.
- Allow multiple occurrences of flag if type is stringArray.

Need to verify that these assumption are correct :)
2019-06-07 10:09:50 -04:00
Haim Ashkenazi e8018e8612 zsh-completion template refactoring:
- removed redundant function
- improved other functions :)
- better names for other functions
2019-06-07 10:09:50 -04:00
Haim Ashkenazi 2662787697 zsh-completion: added support for subcommand description.
Also make the template more elegant on the way...
2019-06-07 10:09:50 -04:00
Haim Ashkenazi f0508c8e76 zsh-completion ignores hidden commands and flags :) 2019-06-07 10:09:50 -04:00
Haim Ashkenazi a15d099018 zsh-completion fixed reference to cmd name
cmd.Use is not the command name :). Found it once I figured out
that I need to execute the command in order to fully test the
generated completion.
2019-06-07 10:09:50 -04:00
Haim Ashkenazi 7e2436b79d First try at better zsh completions:
A very basic POC. Need to refactor to generate completion
structure before passing to the template to avoid repeated
computations.

What works:
  * Real zsh completion (not built on bash)
  * Basic flags (with long flag and optional shorthand)
  * Basic filename completion indication (not with file extensions though)

What's missing:
  * File extensions to filename completions
  * Positional args
  * Do we require handling only short flags?
2019-06-07 10:09:50 -04:00
Willi Eggeling 67fc4837d2 added variable to allow configuration of mousetrap message duration (#809)
new variable MousetrapDisplayDuration allows to modify the default
display duration of 5s, or to completely disable the timeout and wait
for the user to press the return key.
2019-03-20 20:05:52 -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
Daisuke Taniwaki ba1052d4cb Fix two word flags (#807) 2019-03-11 08:55:09 -04:00
Michael 7547e83b2d Run tests against go 1.11 and drop 1.9 (#737)
* Update the Travis and CircleCI Go versions

* Adapt to new gofmt formatting

The formatting of gofmt changed slightly in go 1.11.  The release
notes recommend to use a specific binary of gofmt.  See
https://golang.org/doc/go1.11#gofmt

This commit adapts to the new formatting applied by gofmt and changes
the configs for travis and circleci to run gofmt only with go 1.11.
2019-01-08 19:34:09 -05:00
Daisuke Taniwaki d2d81d9a96 Fix too many underscore for __custom_func (#794)
* Fix too many underscore for __custom_func

* Fix typo of too many leading underscores in docs
2018-11-27 08:31:06 -05:00
Aleksa Sarai fe5e611709 doc: obey SOURCE_DATE_EPOCH with manpage generation (#735)
Previously if a cobra user didn't specify an explicit .Date header, the
current time would be included in all of the generated man pages each
time they were built. This causes an issue for reproducible builds,
since each re-build of a package that includes the man pages will have
different times listed in the man pages.

To fix this, add support for SOURCE_DATE_EPOCH (which is a standardised
packaging environment variable, designed to be used specifically for
this purpose[1]).

[1]: https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-10-21 10:11:14 -04:00
bpdunni f619abc1d7 Added ExactValidArgs (#765) 2018-10-21 10:01:21 -04:00
Garret Kelly 40172f1635 Remove unneeded imports from README.md example (#767) 2018-10-18 10:37:54 -04:00
Alex Mayer 8d114be902 README: Remove Unneeded Newline (#746) 2018-09-15 18:22:04 -04:00
Marian Steinbach 99dc123558 Replace Giant Swarm 'swarm' with 'gsctl' (#738) 2018-08-29 12:07:45 -04:00
Paul 6fd8e29b07 Qualify custom bash func name (#730)
* Qualify custom bash func name

 - fixes issue where multiple cobra apps using custom bash completion
 would have their __custom_func collide
 - support fallback to plain __custom_func to maintain compatibility

#694

* Improve tests for bash completion __custom_func

 - check for the correct number of occurrences of function name

#694
2018-08-21 12:12:02 -04:00
Pascal Dierich ff0d02e855 fix typo in doc/man_docs.go (#732) 2018-08-20 13:45:24 -04:00
Federico 7c4570c3eb #716 - Removed useless libraries in readme (#717)
Signed-off-by: Federico <federico@imaginecurve.com>
2018-07-22 17:56:44 -04:00
Hyang-Ah Hana Kim a114f312e0 fix test build breakage with go1.11 (#712)
As discussed in golang/go#26109, vet typecheck is enabled
in go1.11 and the command_test.go can't be compiled any
more with go1.11 due to the unread variables in the
command_test.go.

Instead of removing the unused variables, this CL reads the
variables and compares the values against the current
behavior so when the related issue is fixed, this test can
be updated accordingly.
2018-06-29 11:25:35 -04:00
Jason Hendry 1e58aa3361 Include a basic example #465 (#631) 2018-05-31 14:03:38 -04:00
Zef Hemel ef82de70bb Fixed code sample for bash completion (#687) 2018-04-27 09:45:50 -04:00
James DeFelice 0ab5b6bcfc doc: hide hidden parent flags (#686)
* fixes #685
2018-04-24 12:15:12 -04:00
Rajat Jindal 7ee208b09f support completions for command aliases (#669)
* support completions for command aliases

* try newer version of shellcheck

* initialize aliashash only when BASH_VERSION > 3
2018-04-23 08:47:20 -04:00