Alex Flint
063a48797d
clean up extraneous test output
2020-04-03 11:52:00 -04:00
Alex Flint
cfdee944f9
Set up CI using github actions
2020-04-03 11:45:13 -04:00
Alex Flint
6f3675fdf1
Merge pull request #109 from alexflint/ignore-env
...
Option to ignore environment variables
2020-03-01 16:47:25 -06:00
Alex Flint
17bbf2e7ef
add Config.IgnoreEnv to ignore environment variables
2020-03-01 16:32:59 -06:00
Alex Flint
ce4cd0ce03
Merge pull request #106 from dallbee/subcommand-usage
...
Subcommand usage options
2020-02-23 11:51:43 -08:00
Alex Flint
82c2a36dd7
Merge pull request #108 from alexflint/readme-placeholder-version
...
Document that the placeholder tag requires v1.3.0
2020-02-23 11:47:36 -08:00
Alex Flint
db9f869c99
Document that the placeholder tag requires v1.3.0
2020-02-23 11:44:00 -08:00
Dylan Allbee
c24567c12e
Fix lint warnings
2020-01-25 11:53:34 -08:00
Dylan Allbee
5df19ebe00
Use command passed into p.Parse(...) write methods
...
It is currently impossible to programatically write help and usage
messages for subcommands, due to parser.WriteHelp and parser.WriteUsage
not taking the state of the parser into account.
Check for the existence of p.lastCmd and use it for the writers when
available.
Enables ability to write unit tests for subcommand help.
2020-01-25 11:53:34 -08:00
Dylan Allbee
338e831a84
Print global options in help for subcommands
...
fixes #101
2020-01-25 11:53:34 -08:00
Alex Flint
e9c71eb4fa
Merge pull request #107 from alexflint/fix-issue-100
...
fix issue with duplicate fields in embedded structs
2020-01-24 14:47:36 -08:00
Alex Flint
cb4e079d13
add a further test
2020-01-24 14:42:49 -08:00
Alex Flint
2cc1f136b1
make sure to deep copy the field indices
2020-01-24 14:34:56 -08:00
Alex Flint
711618869d
fix issue with duplicate fields in embedded structs
2020-01-24 14:30:29 -08:00
Alex Flint
7e2466d707
Merge pull request #105 from marco-m/document-subcommand-fail-early
...
README: how to terminate a program when no subcommands are specified
2020-01-23 11:08:28 -08:00
Alex Flint
f5d3733c0a
Merge pull request #104 from marco-m/subcommands-usage-simple
...
Subcommands usage simple
2020-01-23 11:07:40 -08:00
Marco Molteni
5943b1ad42
README: how to terminate a program when no subcommands are specified
...
Fixes #103
2020-01-23 18:16:28 +01:00
Marco Molteni
9f5522668a
address review comments
2020-01-23 16:35:45 +01:00
Marco Molteni
cfd894f446
usage: if the program supports subcommands, mention it
2020-01-19 19:40:53 +01:00
Marco Molteni
33db14a48b
parse: fix typo in comment
2020-01-19 19:38:19 +01:00
Alex Flint
ced05bfe8a
Merge pull request #96 from Andrew-Morozko/master
...
Added the "placeholder" tag
2019-12-01 01:22:05 -08:00
Andrew Morozko
9d4521ce8b
Final improvements
2019-11-30 22:31:08 +03:00
Andrew Morozko
c49d847704
Removed "dataname" tag
2019-11-30 00:32:28 +03:00
Andrew Morozko
c3a019cdb8
Various changes
2019-11-30 00:22:21 +03:00
Andrew Morozko
904e039267
Added the "dataname" tag
2019-11-29 22:33:16 +03:00
Alex Flint
c0c7a3ba8a
Merge pull request #91 from alexflint/defaults
...
Allow default values in struct tags
2019-10-21 23:40:36 -07:00
Alex Flint
e0fc08f7ad
add docs about old way of specifying defaults
2019-10-21 23:37:12 -07:00
Alex Flint
7ac060af18
update documentation to new way of specifying defaults
2019-10-21 23:13:41 -07:00
Alex Flint
809e9060d0
stop testing with tip on travis
2019-10-21 23:06:31 -07:00
Alex Flint
45d0915afc
Remove %w for compatibility with go<1.13
2019-10-21 11:42:03 -07:00
Alex Flint
84e7a764db
minor cleanups
2019-10-19 23:30:33 -07:00
Alex Flint
cc768447a7
store default values during NewParser
2019-10-19 23:23:32 -07:00
Alex Flint
5d3ebcceee
undo changes to go.mod
2019-10-08 16:47:31 -07:00
Alex Flint
0c95297990
add support for default values in struct tags
2019-10-08 16:39:00 -07:00
Alex Flint
873f3c2cf4
Merge pull request #90 from alexflint/fix-89
...
Multiple args are terminated by "--"
2019-10-05 09:26:10 -07:00
Alex Flint
233d378a50
fix issue 89 (multiple args terminated by "--")
2019-10-04 13:18:17 -07:00
Alex Flint
8baf7040d7
Merge pull request #82 from alexflint/subcommand-impl
...
Add support for subcommands
2019-08-06 16:58:46 -07:00
Alex Flint
11a27074fc
test with go 1.12
2019-08-06 16:49:02 -07:00
Alex Flint
e6003d3b6a
add subcommands to readme
2019-08-06 16:41:50 -07:00
Alex Flint
9f37d5f600
fix typo
2019-08-06 16:38:11 -07:00
Alex Flint
fcdfbc090b
fix comment
2019-08-06 16:00:13 -07:00
Alex Flint
990e87d80d
no need to initialize nil structs during path traversal
2019-05-03 16:32:16 -07:00
Alex Flint
bd97edec87
add Parser.Subcommand and Parser.SubcommandNames
2019-05-03 16:08:29 -07:00
Alex Flint
3c5e61a292
simplify Fprint call
2019-05-03 15:50:41 -07:00
Alex Flint
b83047068d
print help and usage at subcommand level if necessary
2019-05-03 15:49:44 -07:00
Alex Flint
15bf383f1d
add subcommands to usage string
2019-05-03 15:02:10 -07:00
Alex Flint
edd1af4667
Merge remote-tracking branch 'origin/master' into subcommand-impl
...
# Conflicts:
# parse.go
2019-05-03 13:16:52 -07:00
Alex Flint
6de9e789a9
Merge pull request #83 from alexflint/tweak-examples
...
Add expected outputs to all runnable examples
2019-05-03 13:14:44 -07:00
Alex Flint
3392c173d7
add expected output for usage example
2019-05-03 13:07:12 -07:00
Alex Flint
e2ce620ee4
add expected outputs to all examples
2019-05-03 12:56:41 -07:00