Commit Graph

382 Commits

Author SHA1 Message Date
Hugo Hromic b8282df4c4
Fix testable example output comment formatting 2024-06-30 23:46:34 +01:00
Alex Flint 0cc152dce5
Merge pull request #224 from hhromic/better-version-v2
Fix usage writing when using custom version flag
2024-06-30 12:27:39 -04:00
Alex Flint b6422dcbc3
Merge pull request #233 from testwill/typo
fix: typo
2024-06-30 10:32:09 -04:00
Alex Flint 56ee7c97ac
Merge pull request #237 from purpleidea/feat/env-docs
add an example for environment vars with arg names
2024-06-30 10:31:46 -04:00
Alex Flint 177b84441e
Merge pull request #256 from hhromic/fix-246
Use standard exit status code for usage errors
2024-06-30 10:31:00 -04:00
Hugo Hromic c087d71802
Add note for version flag overriding to README 2024-06-30 00:13:28 +01:00
Hugo Hromic c992aa8627
Add more test cases for version help/usage writing 2024-06-30 00:12:34 +01:00
Hugo Hromic bed89eb683
Implement scanning of version flag in specs for usage generation 2024-06-29 23:42:22 +01:00
Hugo Hromic 4ed4ce751f
Better scanning of version flag in specs for help generation 2024-06-29 23:42:22 +01:00
Hugo Hromic a7c40c36a3
Use standard exit status code for usage errors
* The stdlib `flags` package and most command line utilities use status code `2`.
2024-06-29 15:44:50 +01:00
Alex Flint bee5cf5d7c
Merge pull request #255 from hhromic/fix-254
Fix crash on errors in package-level `MustParse`
2024-06-28 11:03:08 -04:00
Hugo Hromic aa844c7de9
Fix crash on errors in package-level `MustParse` 2024-06-27 00:33:09 +01:00
Alex Flint dfca71d159
Merge pull request #243 from alexflint/handle-empty-placeholder
Handle explicit empty placeholders
2024-04-02 12:16:06 -04:00
Alex Flint 188bd31bf6
Merge pull request #244 from alexflint/restore-100pct-coverage
Restore 100% test coverage
2024-04-02 12:14:49 -04:00
Alex Flint 8a917260c3 add a test case with single-level subcommands 2024-04-02 12:10:52 -04:00
Alex Flint 3ddfffdcd3 add test for help and usage when a --version flag is present 2024-04-02 12:05:00 -04:00
Alex Flint 68948b2ac1 restore 100% code coverage 2024-03-31 12:05:26 -04:00
Alex Flint be792f1f8b ping 2024-03-31 11:52:16 -04:00
Alex Flint 8e35a4f0d4 handle explicit empty placeholders 2024-03-31 10:30:12 -04:00
James Shubin 84ddf1d244 add an example for environment vars with arg names
If you want to specify both of these, and if they should have different
names, then this shows you how it can be done.
2024-02-28 22:29:16 -05:00
guoguangwu 582e6d537a fix: typo
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-11-15 17:58:55 +08:00
Alex Flint bf629a16cb
Merge pull request #231 from alexflint/subcommand-aliases
add subcommand aliases
2023-10-10 18:36:46 -04:00
Alex Flint e7a4f77ed0 add a unittest for an internally messed up subcommand path 2023-10-08 20:24:18 -04:00
Alex Flint 960d38c3ce add some more tests for subcommand aliases 2023-10-08 20:14:34 -04:00
Alex Flint 0142b0b842 add subcommand aliases 2023-10-08 20:09:05 -04:00
Alex Flint 5ec29ce755
Merge pull request #229 from alexflint/dependabot/go_modules/gopkg.in/yaml.v3-3.0.0
Bump gopkg.in/yaml.v3 from 3.0.0-20200313102051-9f266ea9e77c to 3.0.0
2023-09-10 15:05:06 -07:00
dependabot[bot] 8e9f60aafc
Bump gopkg.in/yaml.v3 from 3.0.0-20200313102051-9f266ea9e77c to 3.0.0
Bumps gopkg.in/yaml.v3 from 3.0.0-20200313102051-9f266ea9e77c to 3.0.0.

---
updated-dependencies:
- dependency-name: gopkg.in/yaml.v3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-30 13:58:31 +00:00
Alex Flint 660b9045e1
Merge pull request #223 from hhromic/fix-version-flag
Improve handling of version flag
2023-07-14 15:52:33 -04:00
Hugo Hromic c73f38cd54
Improve handling of version flag
* Only use/show builtin `--version` flag if args are versioned with a non-empty `Version()`
* If args define a `--version` flag, honor it and disable/hide the builtin version flag
* Only return `ErrVersion` when using the builtin version flag
2023-07-14 20:12:52 +01:00
Alex Flint 463902ef7d
Merge pull request #222 from IljaN/env-only-args
Support for parameters which can only be passed via env
2023-07-02 10:07:10 -04:00
Ilja Neumann 259c83fd5a Remove usage of additional envOnly struct variable 2023-06-29 21:26:34 +02:00
Ilja Neumann 18623d869b help,usage and error messages and tests 2023-06-03 12:47:47 +02:00
Ilja Neumann b928a1839a Parse env-only vars 2023-06-03 09:50:42 +02:00
Ilja Neumann ccf62e0ffc don't print env-vars in usage line 2023-06-03 03:33:10 +02:00
Pablo Diaz 5f10667949 fixed tests 2023-06-03 02:39:56 +02:00
Pablo Diaz c3cac76438 added tests and fixed usage 2023-06-03 02:39:56 +02:00
Pablo Diaz 0280e6e591 ignores short and long parameters 2023-06-03 02:39:42 +02:00
Alex Flint e25b4707a7
Merge pull request #211 from alexflint/clean-up-osexit-stderr-stdout
clean up customizable stdout, stderr, and exit in parser config
2023-02-08 06:56:56 -08:00
Alex Flint df28e7154b clean up customizable stdout, stderr, and exit in parser config 2023-02-08 09:49:03 -05:00
Alex Flint 5dbdd5d0c5
Merge pull request #210 from cabuda/master
feat: support more env than terminal
2023-02-08 06:13:50 -08:00
duxinlong efae1938fd feat: support more env than terminal
Change-Id: I7f35e90b8f19f4ea781832885d35e2f1e275207a
2023-02-08 12:01:48 +00:00
Alex Flint c0a8e20a0a
Merge pull request #205 from dmzkrsk/strict-subgroup-parsing
add strict subcommand parsing
2023-01-27 08:35:12 -08:00
Alexey Trofimov 5036dce2d6 fix typo 2023-01-18 11:52:13 +03:00
Alexey Trofimov cef66fd2f6 add strict subcommand parsing 2023-01-18 11:50:50 +03:00
Alex Flint 727f8533ac
Merge pull request #185 from alexflint/default-value-issue
Do not turn values intro strings and then back into values when processing default values
2022-10-29 12:29:07 -07:00
Alex Flint 3489ea5b2e in a second place: use reflect.Ptr not reflect.Pointer since the latter was added in Go 1.18 2022-10-29 15:23:56 -04:00
Alex Flint 763072452f use reflect.Ptr not reflect.Pointer since the latter was added in Go 1.18 2022-10-29 15:21:21 -04:00
Alex Flint 3d95a706a6 Merge remote-tracking branch 'origin/master' into default-value-issue 2022-10-29 15:19:23 -04:00
Alex Flint d949871b67 add further comment about backwards-compatible method for setting default values 2022-10-29 15:13:57 -04:00
Alex Flint 9d5e97ac8a drop unnecessary test 2022-10-29 15:12:53 -04:00