Commit Graph
100 Commits
Author SHA1 Message Date
Jesse Szwedko cfb3883072 Prepare CHANGELOG for v1.20.0 release 2017-08-10 18:42:03 -07:00
Jesse Szwedko e1fa109a31 Define flag source precedence in README
Fixes #646
2017-08-10 17:54:24 -07:00
Jesse Szwedko b99aa811b4 Merge pull request #654 from urfave/appveyor-updates
Update os, image, golang, and python versions used in appveyor
2017-08-04 02:34:15 -07:00
Jesse Szwedko 4b90d79a68 Merge pull request #643 from nikkolasg/patch-1
[example] Make the basic example build-able.
2017-07-06 12:46:25 -07:00
Jesse Szwedko b892ba3809 Merge pull request #583 from karalabe/invalidate-isset-cache
Invalidate context.setFlags cache on modification.
2017-06-24 20:28:08 -07:00
Jesse Szwedko 3ac1e107fe Merge pull request #593 from urfave/command-subcommand-usage-text
Display UsageText on Commands and Subcommands
2017-06-24 20:27:41 -07:00
Jesse Szwedko 3ddfc81916 Merge pull request #626 from urfave/do-not-double-print-before-errors
Do not double print errors from Before()
2017-06-24 20:12:38 -07:00
Jesse Szwedko 4fb301aa38 Merge branch 'master' into invalidate-isset-cache 2017-06-24 20:04:24 -07:00
Jesse Szwedko 48db8e2435 Display UsageText on Commands and Subcommands
If it is set, otherwise build the usage.

Fixes #592
2017-06-24 20:02:36 -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
Jesse Szwedko f229e3c59c Merge pull request #629 from josephlr/use-usage-error-for-app
Subcommand OnUsageError should be passed to app
2017-06-24 19:32:30 -07:00
Jesse Szwedko cf33a9befe Merge pull request #586 from minio/extra-info
Add support for custom help templates.
2017-06-11 17:00:38 -07:00
Jesse Szwedko 74811faef3 Merge branch 'master' into extra-info 2017-06-11 16:24:10 -07:00
Jesse Szwedko db0ff44081 Merge pull request #630 from josephlr/support-custom-flags
Add ability to use custom Flag types
2017-06-11 15:37:36 -07:00
Jesse Szwedko d70f47eeca Merge pull request #627 from urfave/use-command-context-in-usage-error
Rely on Command context in Run()
2017-05-05 21:25:29 -07:00
Jesse Szwedko 87fe13079e Rely on Command context in Run()
Was previously relying on the parent context which caused things like
`.Command` to not be available to OnUsageError().

Fixes #609
2017-04-24 15:19:34 -07:00
Jesse Szwedko ab403a54a1 Merge pull request #616 from tbaud0n/master
Fix autocomplete issue when multiple apps run autocomplete from etc/bash_completion.d directory
2017-04-24 14:31:22 -07:00
Jesse Szwedko d3793766a3 Merge branch 'master' into master 2017-04-24 14:13:35 -07:00
Jesse Szwedko f6e8084112 Merge remote-tracking branch 'origin/master' into v1 2017-04-24 11:44:41 -07:00
Jesse Szwedko 924042785a Merge pull request #624 from urfave/fetch-needed-commands
Explicitly fetch `goimports`
2017-04-24 11:43:35 -07:00
Jesse Szwedko 1bf0bb96b7 Only support supported Go versions
As described on https://github.com/golang/go/wiki/Go-Release-Cycle

The maintainers do not test compatibility for libraries (e.g. in
golang.org/x/tools) on older versions.
2017-04-24 11:02:41 -07:00
Jesse Szwedko 572dc46db5 Explicitly fetch goimports
Fetching the whole tree was failing on some Go versions and we really
only need goimports.
2017-04-24 10:40:54 -07:00
Jesse Szwedko 8ba6f23b6e Merge pull request #582 from urfave/fix-altsrc-slice-inputs
Fix altsrc slice inputs so that they correctly parse
2017-03-28 18:35:17 -07:00
Jesse Szwedko beddedeabd Merge branch 'master' into fix-altsrc-slice-inputs 2017-03-27 20:46:54 -07:00
Jesse Szwedko 9e5b04886c Remove logic that exited even if the error was not an OsExiter
This was introduced in #496, but was discovered to be a regression in
the behavior of the library.
2017-03-04 14:33:36 -08:00
Jesse Szwedko 8d8f927bcb Change flag test error checking to use regexp rather than strings
As the error messages changed in 1.8
2017-03-04 14:28:24 -08:00
Jesse Szwedko 2526b57c56 Allow slightly longer lines in Python scripts 2017-02-14 21:17:05 -08:00
Jesse Szwedko 347a9884a8 Merge pull request #589 from josephlr/subcommand-structure
Subcommand structure should be correctly passed to application
2017-01-28 13:39:59 -08:00
Jesse Szwedko 9913f0cef2 Merge branch 'master' into subcommand-structure 2017-01-28 13:35:02 -08:00
Jesse Szwedko 1d38670e45 Merge pull request #587 from guywithnose/master
Pass the ErrWriter on the root app to subcommands
2017-01-28 13:29:39 -08:00
Jesse Szwedko e87dfbb6bb altsrc: Support slices for TOML 2017-01-16 17:34:12 -08:00
Jesse Szwedko f8347a97c6 Fix altsrc slice inputs so that they correctly parse
Was previously attempting to cast directly from []interface{} to
[]string or []int which Go doesn't support. Instead, we iterate over and
cast each value (error'ing if the value is not the correct format).

Fixes #580
2017-01-16 17:22:11 -08:00
Jesse Szwedko 56a7254df4 Merge pull request #540 from hirose31/fix/handle-multierror
Call HandleExitCoder for all members of MultiError.Errors
2017-01-16 14:20:16 -08:00
Jesse Szwedko 8ef3805c9d Merge pull request #575 from MaximilianMeister/command-ordering
command: enable ordering commands by name
2017-01-09 20:57:14 -08:00
Jesse Szwedko 8f6a3675e1 Merge pull request #581 from appleboy/patch-2
[ci skip] fix template syntax error
2017-01-08 17:29:12 -05:00
Jesse Szwedko 4401a6ca20 Merge pull request #566 from fernandezvara/v1
allow to load YAML configuration files on Windows
2016-11-27 13:44:19 -08:00
Jesse Szwedko 6752c11c1c Merge branch 'v1' into v1 2016-11-27 13:32:19 -08:00
Jesse Szwedko 0bdeddeeb0 Merge pull request #569 from urfave/prepare-1-19-1
Prep 1.19.1
2016-11-21 20:36:10 -08:00
Jesse Szwedko 0ef6582154 Prep 1.19.1 2016-11-21 20:26:35 -08:00
Jesse Szwedko 3ba36a3127 Merge pull request #568 from kklipsch/master
Fix for #556 broke the api for users who were using the ActionFunc
2016-11-21 20:21:12 -08:00
Jesse Szwedko b6061c464d Merge pull request #559 from joshuarubin/completion_fix
make shell autocomplete more robust
2016-11-19 11:05:28 -08:00
Jesse Szwedko 7fbcf2396a Update date of 1.19.0 release in CHANGELOG
[ci skip]
2016-11-19 11:04:57 -08:00
Jesse Szwedko a8fc36b690 Update CHANGELOG 2016-11-19 10:55:36 -08:00
Jesse Szwedko 6a87e37dff Merge pull request #564 from urfave/altsrc-errorable-flag
Make ApplyWithError a public method on errorableFlag
2016-11-19 10:51:37 -08:00
Jesse Szwedko d71794de19 Make ApplyWithError a public method on errorableFlag
Add to altsrc flags. Otherwise, flagSet() was bypassing altsrc's attempt
at shadowing.
2016-11-19 10:51:20 -08:00
Jesse Szwedko 8500a4cefd Merge pull request #567 from drekar/errorable-flag-panic-fix
errorableFlag: scope result of type assertion.
2016-11-19 10:11:24 -08:00
Jesse Szwedko b4f4786f37 Merge pull request #529 from urfave/prepare-v1.19.0
Prepare v1.19.0 release
2016-11-13 15:35:18 -08:00
Jesse Szwedko dcdea39be2 Add additional entries to changelog for v.19.0 release 2016-11-13 15:04:31 -08:00
Jesse Szwedko fa7ccb1447 Update changelog 2016-11-13 15:01:04 -08:00
Jesse Szwedko 4c2360f975 Prepare CHANGELOG for v1.19.0 2016-11-13 15:01:04 -08:00
Jesse Szwedko de551c4450 Backport removal of deprecation warnings
#508
2016-11-13 15:01:04 -08:00
Jesse Szwedko 31b79c9a33 Merge pull request #530 from urfave/consider-empty-env-vars
Consider empty environment variables as set
2016-11-13 15:00:04 -08:00
Jesse Szwedko b4a64dc08d Add windows implementation of Clearenv for tests
Apparently `Clearenv` in Windows just sets the variables to ""
2016-11-13 14:59:35 -08: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 a00c3f5872 Consider empty environment variables as set
When assigning values to flags (also when interogatting via
`context.(Global)IsSet`.

For boolean flags, consider empty as `false`.

Using `syscall.Getenv` rather than `os.LookupEnv` in order to support
older Golang versions.
2016-11-13 14:59:27 -08:00
Jesse Szwedko 7a5dacbc41 Merge pull request #560 from mh-cbon/master
Close #558: detect FormattedError and print their stack trace
2016-11-13 13:44:15 -08:00
Jesse Szwedko af372e8e2a Merge branch 'master' into master 2016-11-12 14:32:21 -08:00
Jesse Szwedko 88ae7af8d4 Merge pull request #563 from urfave/print-help-if-no-action
If no action is specified on the command or app, print the help documentation
2016-11-12 13:49:46 -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
Jesse Szwedko 36053a9dfd Merge branch 'master' into fix/handle-multierror 2016-11-12 12:46:57 -08: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 3eb41f1bb1 Merge pull request #547 from urfave/default-writer
Default app.Writer to os.Stdout
2016-10-29 18:45:05 -07:00
Jesse Szwedko 61db37e7ae Merge branch 'master' into default-writer 2016-10-29 18:36:19 -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
Jesse Szwedko b803494208 Merge pull request #542 from mhmxs/patch-1
Display error instead of just say command is incorrect
2016-10-25 21:52:14 -07:00
Jesse Szwedko 6f2647a880 Merge pull request #544 from runcom/sort-flags
flags: sort flags
2016-10-22 10:29:59 -07:00
Jesse Szwedko 64fcd51526 Merge branch 'master' into sort-flags 2016-10-22 10:22:16 -07:00
Jesse Szwedko 3f4989051e Merge pull request #550 from runcom/test-go-1-7
.travis.yml: add go 1.7.x
2016-10-22 09:40:07 -07:00
Jesse Szwedko 508a23430b Default app.Writer to os.Stdout
As NewApp() does.

Fixes #545
2016-10-18 20:56:31 -07:00
Jesse Szwedko 55f715e28c Merge pull request #541 from dotCipher/patch-1
Typo in comments
2016-10-05 20:53:53 -07:00
Jesse Szwedko d53eb99165 Merge pull request #531 from keloyang/SkipFlagParsing-SkipArgReorder-bugfix
bug fix when SkipFlagParsing is false and SkipArgReorder is true
2016-09-17 14:38:06 -07:00
Jesse Szwedko 61f519fe5e Merge pull request #528 from urfave/backport-no-arg-reordering
Backport no argument reordering as an option
2016-09-11 20:00:11 -07:00
Frances Bar 3df4b71842 Backport no argument reordering as an option
In the unreleased version 2, the argument reordering has been removed
(in f585ec7cb8) since it only worked if
all of the arguments appeared before all of the flags, but not if they
were intermixed which was of limited utility and caused some confusion.
This commit allows enabling of this future behavior via SkipArgReorder.

Ideally we'd support complete intermingling of flags and arguments, but
this is unlikely to happen until we switch flag parsers.

Fixes #515
2016-09-11 12:04:35 -07:00
Jesse Szwedko e7b1833f53 Dereference Flags if they are pointers
When checking if environment variables are set.

We don't support pointer flags currently (though this is the default in
the `v2` branch), but this fixes #516
2016-09-08 21:10:46 -07:00
Jesse Szwedko 4b62cb6b33 Update wording around gopkg.in pinning to be more accurate
Since we have `v1.X` tags, gopkg.in/urfave/cli.v1 will pull the latest
tagged release rather than the `v1` branch. Since there are no tagged
`v2` releases, `gopkg.in` will pull the latest commit of that branch.

Fixes #513
2016-09-03 14:23:36 -07:00
Jesse Szwedko df95e0708f Manually set import in altsrc flag generation
Otherwise `goimports` switches it to `github.com/urfave/cli`
2016-09-03 14:22:45 -07:00
Jesse Szwedko 33bb4c1213 Merge pull request #511 from grubernaut/f-update-altsrc-import-v1
Fix import paths in altsrc
2016-08-28 13:23:14 -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
Jesse Szwedko 168c95418e Ensure that EnvVar struct field exists before interrogating it
Otherwise you end up with `<invalid Value>` which, in practice, would
probably work, but this is cleaner.
2016-07-31 20:11:16 -07:00
Jesse Szwedko 6c1f51aa95 Fix context.(Global)IsSet to respect environment variables
This appeared to be the least messy approach to hack in support for
IsSet also checking environment variables to see if a particular
cli.Flag was set without making backwards incompatible changes to the
interface.

I intend to fix this more properly in v2, probably by adding another
method to the cli.Flag interface to push the responsibility down as it
occurred to me that it was really the `Flag`s themselves that offer
support for configuration via the environment as opposed to the
`context` or other supporting structures. This opens the door for the
anything implementing the `Flag` interface to have additional sources of
input while still supporting `context.IsSet`.
2016-07-31 14:14:46 -07:00
Jesse Szwedko b616f60886 Note TOML support in README and CHANGELOG 2016-07-31 12:11:52 -07:00
Jesse Szwedko a71fcd8f23 Merge pull request #491 from ykanda/toml-support
Add TOML config file loader
2016-07-31 12:06:35 -07:00
Jesse Szwedko d9021faab6 Merge pull request #500 from npcode/readme-remove-v
README: Remove unnecessary 'v' from version numbers
2016-07-25 18:14:03 -07:00
Jesse Szwedko 65da20beab Correctly show help message if -h is provided to subcommand
Currently, if an action is specified on a subcommand, it ignores the
`-h` and `--help` flags if passed to the subcommand, e.g.:

`foo bar -h`

would call the default action on `bar` rather than show the help
documentation.

Fixes #477
2016-07-13 14:48:16 -07:00
Jesse Szwedko 73aa67b7a2 Merge pull request #466 from urfave/flag-context-gen
Generate code for flag types and context accessors
2016-07-13 14:07:04 -07:00
Jesse Szwedko 1efa31f08b Release v1.18.0 2016-06-27 22:30:56 -07:00
Jesse Szwedko 2ec9cfb7f9 Add missing fixes to CHANGELOG.md 2016-06-27 22:28:27 -07:00
Jesse Szwedko 4205e9c4ee Merge pull request #463 from urfave/help-command-categorization
Help command categorization
2016-06-22 09:55:33 -05:00
Jesse Szwedko 06a850dff5 Merge pull request #456 from urfave/uint-flags
Add UintFlag, Uint64Flag types and supporting code
2016-06-16 11:58:30 -04:00
Jesse Szwedko 7817f72540 Merge pull request #450 from urfave/flag-value-changelog-mention
Mention #448 fix in change log
2016-06-08 19:50:24 -07:00
Jesse Szwedko 01a3382359 Merge pull request #444 from urfave/more-v1-examples
Add more v1 API examples
2016-06-01 20:01:28 -07:00
Jesse Szwedko 2ae9042f5b Merge pull request #422 from urfave/update-references-to-codegangsta
Update references to codegangsta to urfave (new org name)
2016-05-22 14:46:02 -07: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
Jesse Szwedko bebbcf6d41 Merge pull request #417 from codegangsta/trim-go1.1-support
Trim go1.1 support
2016-05-21 11:46:57 -07:00
Jesse Szwedko 7f0ca9a349 Merge pull request #404 from codegangsta/runtests-argparse
Use argparse in runtests
2016-05-10 21:09:50 -07:00
Jesse Szwedko 92897b9bf6 Updating coverage badges 2016-05-10 20:42:38 -07:00
Jesse Szwedko 152e6ca11a Merge pull request #407 from codegangsta/coverage-breakout
Separate badges for package coverage
2016-05-10 20:39:12 -07:00
Jesse Szwedko f7b459e346 Merge pull request #406 from codegangsta/command-alias-help
Fix command alias printing in help text
2016-05-10 10:56:23 -07:00
Jesse Szwedko 9f09b40642 Merge pull request #400 from codegangsta/coverage
Add a vet/test runner script with coverage on by default
2016-05-09 22:16:32 -07:00