Commit Graph

217 Commits

Author SHA1 Message Date
Tyler Davis 40263f4d6a Merge branch 'master' into master 2017-10-13 12:05:14 -07:00
Sebastian Sprenger c202606a17 fix golint issues 2017-10-06 07:29:13 +02:00
OneOfOne 163f247519 lint + DefaultCommand 2017-08-29 17:26:30 +02:00
Dan Buch a61867e5e6 Merge remote-tracking branch 'origin/v1' into merging-from-v1 2017-08-04 11:59:27 -04:00
Tyler Davis 172bb92059 fix named parameter issue 2017-06-28 10:07:25 -07:00
Tyler Davis 530df59178 Pass context into handleExitCoder 2017-06-28 09:52:12 -07:00
Tyler Davis ceee6408d5 Revert "Fix how to do defaults in app.go"
This reverts commit 8906567dc2ad52fd31c50cf02fa606505a1323ba.
2017-06-28 09:38:48 -07:00
Tyler Davis 80b09a4d11 Fix how to do defaults in app.go 2017-06-28 09:38:48 -07:00
Tyler Davis 827da610b4 Add a bit more documentation 2017-06-28 09:38:48 -07:00
Tyler Davis c48a829640 Allow custom exit err handlers 2017-06-28 09:38:48 -07:00
Jesse Szwedko c64d74a5d9 Do not double print errors from Before()
They should be handled by HandleExitCoder() as `After()` errors are.
2017-06-24 19:57:19 -07:00
Harshavardhana baa33cb888 Add support for ExtraInfo. 2017-05-08 09:53:53 -07:00
Harshavardhana f7d6a07f2d Add support for custom help templates. 2017-05-08 09:53:53 -07:00
Kasey Klipsch 8fa549846e #556 broke the api for users who were using the ActionFunc 2016-11-21 09:47:23 -06:00
Joshua Rubin 2da42640ad Merge remote-tracking branch 'origin/master' into completion_fix 2016-11-18 09:28:39 -07:00
Joshua Rubin 8dd1962f7b change "complete" to "shellComplete" 2016-11-14 09:35:22 -07:00
Jesse Szwedko e367fafa3d Return an error when parsing environment variables for values fails
Currently cli silently (aside from IntSlice and Int64Slice which oddly
printed directly to the error stream) ignores failures that occur when
parsing environment variables for their value for flags that define
environment variables. Instead, we should propogate up the error to the
user.

This is accomplished in a backwards compatible manner by adding a new,
internal, interface which defines an applyWithError function that all
flags here define. In v2, when we can modify the interface, we can drop
this secondary interface and modify `Apply` to return an error.
2016-11-13 14:59:35 -08:00
Jesse Szwedko 0113f56d10 If no action is specified on the command or app, print the help documentation
Rather than panic'ing or displaying an opaque error message about the
signature which is more confusing to the end user.

Fixes #562
2016-11-12 13:37:07 -08:00
Joshua Rubin ea3df26e64 make shell autocomplete more robust 2016-11-04 14:56:28 -06:00
Jesse Szwedko b377b5d9e9 Use type assertions rather than reflection to determine how to call the Action
This has some benefits, but results in possibly less informative error
messaging; however, given that there are only two accepted types,
I think the error messaging is sufficient.
2016-11-01 20:33:12 -07:00
Jesse Szwedko 61db37e7ae Merge branch 'master' into default-writer 2016-10-29 18:36:19 -07:00
Jesse Szwedko 83497d2cda Merge remote-tracking branch 'origin/master' into v2-merge 2016-10-29 14:13:18 -07:00
Jesse Szwedko f614c177b7 Merge pull request #543 from wking/app-description
app: Add App.Description
2016-10-25 21:54:02 -07:00
W. Trevor King 0c143a2a26 app: Fix trailing space for Author.String()
This code initially landed with lots of space:

  '{name}  <{email}> '

or:

  '{name} '

in 3d718330 (app, help: add support for multiple authors, 2015-01-31).
The doubled space between the name and email was removed in c6592bb4
(app, help: add backwards compatibility for Authors, 2015-02-21), but
a trailing space remained in both the email and email-less cases.
This commit removes that trailing space.
2016-10-22 15:58:07 -07:00
Richard Kovacs 4cc2bad36e Display error instead of just say command is incorrect 2016-10-19 13:31:05 +02:00
Jesse Szwedko 508a23430b Default app.Writer to os.Stdout
As NewApp() does.

Fixes #545
2016-10-18 20:56:31 -07:00
W. Trevor King c4a46a7df2 app: Add App.Description
So you can describe what the application is for without requiring
users to drill down into a particular command.
2016-10-12 08:06:41 -07:00
Jesse Szwedko a5ca09a934 fixup! remove the possiblity of end-user's seeing deprecation warnings 2016-08-21 14:06:59 -07:00
Jesse Szwedko 8e6aa34a12 remove the possiblity of end-user's seeing deprecation warnings
Instead use deprecation pattern described in
https://blog.golang.org/godoc-documenting-go-code.

Fixes #507
2016-08-21 13:51:55 -07:00
Antoine Eiche 94bc26fd1c Refactoring names from bash to shell
The refactoring is required since completion is also supported for zsh
shell.

Refactoring details:
- flag generate-bash-completion -> generate-completion
- var  EnableBashCompletion     -> EnableShellCompletion
- var  BashComplete             -> ShellComplete
- var  BashCompletionFlag       -> GenerateCompletionFlag
- type BashCompleteFunc         -> ShellCompleteFunc
2016-07-26 15:32:03 +02:00
Antoine Eiche 7640bef0eb Add --init-completion flag to print completion code
This flag takes as input 'bash' or 'zsh' and generates the completion
code for the specified shell.
2016-07-26 15:32:03 +02:00
Dan Buch f7b2b93ffa Merge remote-tracking branch 'origin/v1' into merging-from-v1 2016-07-14 17:50:16 -04:00
Radek Simko bef215fe3e app: Allocate Metadata map automatically 2016-07-11 07:39:58 +01:00
Dan Buch 99621d571e Merge remote-tracking branch 'origin/v2' into declarativeness 2016-06-22 23:07:20 -04:00
Dan Buch df685fbacc Remove NewApp initializer
and move defaulting to `App.Setup`
2016-06-22 12:47:57 -04:00
Dan Buch 0f135b318e Merge remote-tracking branch 'origin/v1' into merging-from-v1 2016-06-22 12:03:21 -04:00
Dan Buch 5c7afce5b8 Add help command before category scan/sort 2016-06-22 09:34:24 -04:00
Dan Buch 5a3515fdf8 Focus on catching fewer panics in HandleAction
so that "unknown" panics can still bubble up.
2016-06-09 17:32:00 -04:00
Dan Buch 3d75e9e711 Go with interfaces + private opaque types
rather than public types that wrap slices
2016-05-25 12:05:14 -04:00
meatballhat c70993dbc5 Merge branch 'v2' into minimize-struct-copying 2016-05-23 22:08:59 -04:00
Dan Buch 8f25dbb615 Ensure all flag aliases are set when Destination given
and extend "Incorrect Usage" message to show the error.

Closes #430
2016-05-23 22:00:59 -04:00
Dan Buch 61710ff108 Make slice wrapping pattern more consistent
and move *Args out into its own file
2016-05-23 20:15:35 -04:00
Jesse Szwedko 024b4c6240 Update references to codegangsta to urfave (new org name)
Also add notice to README
2016-05-22 14:42:23 -07:00
Dan Buch cd10b49473 Minimize struct copying
by using pointer func receivers and slices of struct pointers where possible.
2016-05-22 15:20:52 -04:00
Dan Buch 81fcf706ea Replace all "stringly typed" fields with slice equivalents
and alter the Flag interface accordingly

Closes #415
2016-05-21 21:29:45 -04:00
Dan Buch c19dbaf230 Remove deprecated things and supporting code 2016-05-17 15:11:44 -04:00
Matt Farina 07ce8bf79c Cleaned up else per golint
When an if ends in a return the else is not required. golint
detects these conditions and found these.
2016-05-09 10:15:05 -04:00
Matt Farina 2f110bd745 Cleaned up exported func comments per golint 2016-05-09 10:12:59 -04:00
Matt Farina 2f4ec31264 Fixed spelling and gofmt issues 2016-05-09 09:40:09 -04:00
Dan Buch 97d2df6dd7 Merge remote-tracking branch 'origin/master' into psmit-hidden_command 2016-05-08 18:44:38 -04:00