Commit Graph

25 Commits

Author SHA1 Message Date
8dc47eb3cb
Merge branch 'master' into backport-json-support 2018-02-25 16:09:48 -05:00
Sebastian Sprenger
c202606a17 fix golint issues 2017-10-06 07:29:13 +02:00
Jesse Szwedko
f5513590f5 Merge branch 'master' into backport-json-support 2017-08-10 18:06:12 -07:00
John Weldon
6a70c4cc92 Add JSON InputSource to altsrc package
- Implement NewJSONSource* functions for returning an InputSource from
   various JSON data sources.
 - Copy and modify YAML tests for the JSON InputSource

Changes:

* Reverted the method calls and structs to match the v1 interface
2017-02-14 21:07:04 -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
Antonio Fdez
f1be59ff3d added comment to windows filePath check 2017-01-16 17:19:38 -08:00
Antonio Fdez
341ca93b01 fix imports
Sorry, forgot to add imports correctly, needed to edit the file and make the commit using the github online editor, since I can't access from my current location from git.
2017-01-16 17:19:33 -08:00
Antonio Fdez
7b912d9f8f allow to load YAML configuration files on Windows
The funtion `loadDataFrom` does not take care of Windows users since any of the conditions met and it returns an error.

The change looks for the runtime where it's running and then if the filePath contains a `\`
2017-01-16 17:19:29 -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
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
Jake Champlin
c75c862386
Fix import paths in altsrc
Uses gopkg.in as the import path for the `altsrc` package.

Fixes: #473
2016-08-27 19:09:14 -04:00
kandayasu
36b7d89bed Fix typo 2016-07-26 01:37:18 +09:00
kandayasu
812de9e250 type "TomlMap" to private (rename TomlMap -> tomlMap) 2016-07-26 01:37:03 +09:00
Yasuhiro KANDA
3fc3cd6485 Add TOML config file loader 2016-07-24 01:35:11 +09:00
Dan Buch
c3b03b8437
Adding flag type generation for altsrc
and a mention of this whole thing in the change log
2016-07-11 06:02:49 -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
fed78b8bab
Rework of hidden flag impl plus some Action func corrections 2016-05-01 08:36:17 -04:00
15d4455a61 Merge pull request #365 from roboll/nested-flags
altsrc: allow nested defaults in yaml files
2016-04-30 13:25:48 -04:00
rob boll
36a5323a47 altsrc: allow nested defaults in yaml files
Previously, defaults specified as nested keys in a yaml file would not
be recognized, i.e. `top: \n  bottom: key` would not be accessible using
the name `top.bottom`, but `top.bottom: key` would. These changes
support using nested keys by traversing the configuration tree if the
key name uses '.' as a delimiter.
2016-04-29 13:28:59 -04:00
Dan Buch
b7329f4968
Switch from multi-return with exit codes to ExitCoder check 2016-04-27 09:12:34 -04:00
Dan Buch
a17c8cf1d8
Rename func type suffixes Fn->Func and add OnUsageErrorFunc 2016-04-25 18:29:05 -04:00
Dan Buch
10c8309d84
Merge branch 'develop' of https://github.com/txgruppi/cli into txgruppi-develop 2016-04-25 18:10:10 -04:00
Yasuhiro KANDA
ad7ed77a7e Fix yaml file loader
* fix typo (yamlSourceLoader -> yamlSourceContext)
* fix function return type (NewYamlSourceFromFlagFunc)

Also fixed build tags to properly build on >=go1.2

Signed-off-by: Jesse Szwedko <jesse.szwedko@gmail.com>
2016-03-20 12:42:00 -07:00
chrisprobinson
d3b02e41b0 Update to add build contraints to not compile in yaml support
in the case the golang version is less than golang 1.2
2016-02-21 20:06:02 -08:00