commitc71fbcefd2Merge:61f3ae3ef47250Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Thu Sep 12 05:35:50 2019 +0530 Merge pull request #887 from urfave/asahasrabuddhe-patch-1 Release 1.22.1 commitef47250cdaMerge:71eaf3761f3ae3Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Thu Sep 12 05:19:58 2019 +0530 Merge branch 'master' into asahasrabuddhe-patch-1 commit61f3ae353bMerge:388c2ddfa858dcAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Thu Sep 12 05:19:33 2019 +0530 Merge pull request #890 from urfave/issue-878 Fix #878 commitfa858dcc26Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Wed Sep 11 15:10:14 2019 +0530 Ensure flag is not blank commitf8bb66ae7dAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Wed Sep 11 14:42:38 2019 +0530 Fix Typo commit056aef13feMerge:c6ee3b482a84fcAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Wed Sep 11 14:37:06 2019 +0530 Merge branch 'issue-878' of https://github.com/urfave/cli into issue-878 commitc6ee3b4904Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Wed Sep 11 14:34:41 2019 +0530 Use iterative logic to determine missing flag commit82a84fc187Merge:1547ac2388c2ddAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 14:17:11 2019 +0530 Merge branch 'master' into issue-878 commit1547ac2f6aAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Wed Sep 11 14:15:20 2019 +0530 Modify variable names commit388c2dd0f4Merge:e19126a6d888d6Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 14:13:40 2019 +0530 Merge pull request #891 from saschagrunert/fish-hidden Don't generate fish completion for hidden commands commit71eaf37e33Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 14:09:50 2019 +0530 Update CHANGELOG.md commit6d888d693dMerge:bac5bdee19126aAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 14:04:44 2019 +0530 Merge branch 'master' into fish-hidden commite19126a819Merge:b207e2035eb598Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 14:01:44 2019 +0530 Merge pull request #883 from urfave/remove-flag-generation Remove flag generation commitbac5bde38cAuthor: Sascha Grunert <sgrunert@suse.com> Date: Wed Sep 11 09:06:02 2019 +0200 Don't generate fish completion for hidden commands Added the missing test case as well. Signed-off-by: Sascha Grunert <sgrunert@suse.com> commit36cdaa9964Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 10:34:00 2019 +0530 Update CHANGELOG.md commitcbb9e015b8Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 09:21:45 2019 +0530 Improve Code and Add Test Case commit7d6a604106Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 08:59:51 2019 +0530 Fix #878 commitbe37c2cbdaMerge:0aee120b207e20Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 08:27:45 2019 +0530 Merge branch 'master' into asahasrabuddhe-patch-1 commit35eb598d43Merge:8575558b207e20Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 05:39:35 2019 +0530 Merge branch 'master' into remove-flag-generation commit0aee120c32Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 05:37:41 2019 +0530 Update CHANGELOG.md commit5c019b10caAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Sep 11 05:33:46 2019 +0530 Update CHANGELOG.md commitb207e20873Merge:249cb33487be14Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Tue Sep 10 21:28:35 2019 +0100 Merge pull request #889 from crosbymichael/hidden-man Don't output hidden commands for man pages commit487be14dceAuthor: Michael Crosby <crosbymichael@gmail.com> Date: Tue Sep 10 13:49:11 2019 -0400 Don't output hidden commands for man pages Signed-off-by: Michael Crosby <crosbymichael@gmail.com> commit85755588acMerge:024692c249cb33Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Tue Sep 10 15:04:12 2019 +0530 Merge branch 'master' into remove-flag-generation commit249cb33392Merge:bfe2e92abfb13bAuthor: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Tue Sep 10 08:28:09 2019 +0100 Merge pull request #885 from urfave/go-modules-support Go modules support commitabfb13b854Merge:534d60bbfe2e92Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Tue Sep 10 06:56:41 2019 +0530 Merge branch 'master' into go-modules-support commit054fbefec3Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Tue Sep 10 06:42:34 2019 +0530 Update CHANGELOG.md commit534d60bb9bAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Tue Sep 10 06:40:45 2019 +0530 Bump minimum supported version of Go to 1.11 commit024692c172Merge:4a9e440bfe2e92Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Tue Sep 10 06:33:21 2019 +0530 Merge branch 'master' into remove-flag-generation commitbfe2e925cfMerge:3eca109238c80fAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Tue Sep 10 06:24:10 2019 +0530 Merge pull request #882 from urfave/lynncyrin-patch-1 Release 1.22.0 commit426e21c150Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Mon Sep 9 13:15:47 2019 +0530 Update .travis.yml Set GOPROXY in Travis environment commit39bd617664Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Mon Sep 9 08:37:16 2019 +0530 Cleanup after before_script to avoid git diff errors remove windows build commitedbf66c25cAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Mon Sep 9 08:23:04 2019 +0530 Update gfmrun import command to suite Go Modules pattern Fix test command typo in travis script commitafd0ecbbf2Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Mon Sep 9 08:19:06 2019 +0530 Add support for Go 1.13 Drop support for Go 1.11 Use md2man v2 to avoid dependency issues when building with Go Modules Enabled Update TravisCI build environment images (trusty was deprecated) Add optional Windows build commit4a9e440503Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Mon Sep 9 08:12:09 2019 +0530 Fix AppVeyor build commit5c81af9f10Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Mon Sep 9 07:47:18 2019 +0530 Remove generate script from travis flow Remove unused dependencies from travis script commitb6c5d17a83Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Mon Sep 9 07:44:07 2019 +0530 Remove Flag Generation Remove Legacy Python Scripts commit238c80f9b5Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Sep 7 20:44:48 2019 -0700 Update CHANGELOG.md commit980742b7ccAuthor: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Sep 7 20:43:56 2019 -0700 typo commit890d49ca7aAuthor: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Sep 7 20:41:44 2019 -0700 Release 1.22.0 - adds the changelog for 1.22.0 - updates the changelog for 1.21.0. some PRs were missed, as was mentioned here https://github.com/urfave/cli/pull/829#issuecomment-517968795 - closes https://github.com/urfave/cli/issues/867 commit3eca1090a3Merge:38a6c564bbff84Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Fri Aug 30 15:53:55 2019 +0100 Merge pull request #879 from saschagrunert/escape-single-quotes Escape single quotes in fish shell completion commit4bbff84169Author: Sascha Grunert <sgrunert@suse.com> Date: Thu Aug 29 14:45:32 2019 +0200 Escape single quotes in fish shell completion Single quotes can break the generated fish shell completion and should be escaped correctly. Signed-off-by: Sascha Grunert <sgrunert@suse.com> commit38a6c560b3Merge:fa6797b687f721Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Thu Aug 29 20:52:07 2019 +0100 Merge pull request #857 from saschagrunert/takes-file-fish Add `TakesFile` to fish shell completion commit687f721eaaAuthor: Sascha Grunert <sgrunert@suse.com> Date: Mon Aug 26 10:07:50 2019 +0200 Update function alignment Signed-off-by: Sascha Grunert <sgrunert@suse.com> commit0c01922a12Author: Sascha Grunert <sgrunert@suse.com> Date: Mon Aug 26 08:46:55 2019 +0200 Add type switch Signed-off-by: Sascha Grunert <sgrunert@suse.com> commit38d0ac6296Author: Sascha Grunert <mail@saschagrunert.de> Date: Sun Aug 25 17:50:18 2019 +0200 Removed GetTakesFile and stick to type assertions Signed-off-by: Sascha Grunert <mail@saschagrunert.de> commita1cf7f44b6Author: Sascha Grunert <sgrunert@suse.com> Date: Mon Aug 12 09:42:12 2019 +0200 Add `TakesFile` to fish shell completion The new `TakesFile` flag will be now consumed by the fish shell completion generator. Signed-off-by: Sascha Grunert <sgrunert@suse.com> commitfa6797beefMerge:2344c9882eb0d7Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Aug 24 18:58:52 2019 -0700 Merge pull request #876 from urfave/lynncyrin-patch-1 Bump go version to 1.10 in readme commit82eb0d70cbMerge:edd8cb22344c98Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Sun Aug 25 01:04:33 2019 +0100 Merge branch 'master' into lynncyrin-patch-1 commit2344c98f67Merge:55de01168ee2bcAuthor: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Sun Aug 25 01:04:17 2019 +0100 Merge pull request #860 from saschagrunert/takes-file-not-all Update `TakesFile` flag to apply only to supported flags commitedd8cb2068Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Aug 24 14:44:56 2019 -0700 Bump go version to 1.10 in readme Closes https://github.com/urfave/cli/issues/875 commit68ee2bc4afMerge:959d9ec55de011Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Aug 24 14:34:15 2019 -0700 Merge branch 'master' into takes-file-not-all commit55de011cf8Merge:392c1ded3edef8Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Sat Aug 24 11:55:28 2019 +0100 Merge pull request #873 from urfave/show-test-failures build: show failures when running tests commitd3edef887aAuthor: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Sat Aug 24 11:34:03 2019 +0100 Update build.go commitc2d1a13208Author: Lynn Cyrin <lynn@textio.com> Date: Sat Aug 24 03:05:45 2019 -0700 Revert "check length" This reverts commit1095838cca. commit959d9ec36bMerge:3681b05392c1deAuthor: Sascha Grunert <sgrunert@suse.com> Date: Sat Aug 24 11:23:51 2019 +0200 Merge branch 'master' into takes-file-not-all commit7d62a9d054Merge:1095838392c1deAuthor: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Aug 24 00:50:42 2019 -0700 Merge branch 'master' into show-test-failures commit1095838ccaAuthor: Lynn Cyrin <lynn@textio.com> Date: Sat Aug 24 00:49:29 2019 -0700 check length commit29ad6ee6adAuthor: [[ BOT ]] Lynn Cyrin <lynncyrin@gmail.com> Date: Fri Aug 23 20:09:08 2019 -0700 DRY commit392c1de1a2Merge:23c8303487c723Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Fri Aug 23 22:51:39 2019 +0100 Merge pull request #874 from saschagrunert/go-mod-cleanup Cleanup go modules commit487c723673Author: Sascha Grunert <sgrunert@suse.com> Date: Fri Aug 23 10:28:32 2019 +0200 Cleanup go modules These two dependencies are not really needed, which can be reproduced via: ``` > export GO111MODULE=on && go mod tidy ``` Signed-off-by: Sascha Grunert <sgrunert@suse.com> commit8469a9de07Author: [[ BOT ]] Lynn Cyrin <lynncyrin@gmail.com> Date: Thu Aug 22 21:42:07 2019 -0700 show test failures commit23c8303026Merge:ecd576e6a25af9Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Aug 17 11:24:05 2019 -0700 Merge pull request #862 from russoj88/UpdateREADME_gopkg.in_v1 Rewrite the "pinning to v1" section. commit6a25af9641Merge:3bc62c4ecd576eAuthor: russoj88 <russoj88@users.noreply.github.com> Date: Sat Aug 17 10:01:35 2019 -0700 Merge branch 'master' into UpdateREADME_gopkg.in_v1 commitecd576e779Merge:6cc7e98e11183fAuthor: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Sat Aug 17 16:51:43 2019 +0100 Merge pull request #868 from urfave/lynncyrin-patch-1 Modernize readme commite11183fe50Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Aug 17 02:44:49 2019 -0700 Modernize readme I assume that people no longer care about what the package was named many years ago commit3bc62c4fdeAuthor: russoj88 <russoj88@gmail.com> Date: Thu Aug 15 12:30:29 2019 -0700 Mimic v2 example code from above. commit62b8a7cc2cAuthor: russoj88 <russoj88@gmail.com> Date: Wed Aug 14 11:20:09 2019 -0700 Add "Using v1 releases" to table of contents. commitcc091db561Author: russoj88 <russoj88@users.noreply.github.com> Date: Wed Aug 14 11:21:40 2019 -0700 Update README.md Only instruct on right way to use library. Co-Authored-By: Lynn Cyrin (they/them) <lynncyrin@gmail.com> commitf529dad70cAuthor: russoj88 <russoj88@users.noreply.github.com> Date: Wed Aug 14 11:20:58 2019 -0700 Update README.md Include suggestion to put example in. Co-Authored-By: Lynn Cyrin (they/them) <lynncyrin@gmail.com> commitf2c26bab77Author: russoj88 <russoj88@gmail.com> Date: Tue Aug 13 21:10:38 2019 -0700 Rewrite the "pinning to v1" section. commit3681b057c5Author: Sascha Grunert <sgrunert@suse.com> Date: Tue Aug 13 09:43:57 2019 +0200 Update `TakesFile` flag to apply only to supported flags Signed-off-by: Sascha Grunert <sgrunert@suse.com> commit6cc7e987c4Merge:7e49cc208c24e2Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Mon Aug 12 21:30:37 2019 +0100 Merge pull request #856 from FaranIdo/master Add Subcommand fallback call to ExitErrHandler, fixing #816 commit08c24e22edAuthor: FaranIdo <idoosbron@gmail.com> Date: Mon Aug 12 00:29:46 2019 +0300 add missing ExitErrHandler in command + matching test, fixing #816 commit7e49cc210aMerge:8b18c714e42a2fAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sat Aug 10 09:01:16 2019 +0000 Merge pull request #848 from saschagrunert/fish-shell Add fish shell completion support commit4e42a2f02cMerge:56d12d08b18c71Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sat Aug 10 08:47:31 2019 +0000 Merge branch 'master' into fish-shell commit8b18c71e1aMerge:7058c58c6c2008Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sat Aug 10 08:47:23 2019 +0000 Merge pull request #851 from saschagrunert/takes-file Add `TakesFile` indicator to flag commit56d12d0c2fMerge:7506b117058c58Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Fri Aug 9 17:21:24 2019 +0530 Merge branch 'master' into fish-shell commitc6c200864dMerge:e9e9e0a7058c58Author: Sascha Grunert <sgrunert@suse.com> Date: Fri Aug 9 13:48:36 2019 +0200 Merge branch 'master' into takes-file commit7058c58eb6Merge:2e0e39ade0fa70Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Fri Aug 9 17:16:13 2019 +0530 Merge pull request #847 from saschagrunert/remove-date-var Remove unused `Date` variable from `cliTemplate` commitde0fa70433Merge:0d79d1d2e0e39aAuthor: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Fri Aug 9 12:38:50 2019 +0100 Merge branch 'master' into remove-date-var commite9e9e0ac5dAuthor: Sascha Grunert <sgrunert@suse.com> Date: Fri Aug 9 09:05:55 2019 +0200 Add `TakesFile` indicator to flag This new member of `Flag` indicates if the flag expects a file as input. This is especially useful for documentation and shell completion purposes. Signed-off-by: Sascha Grunert <sgrunert@suse.com> commit7506b11da7Author: Sascha Grunert <sgrunert@suse.com> Date: Thu Aug 8 15:50:36 2019 +0200 Add fish shell completion support This commit adds a new method `ToFishCompletion` to the `*App` which can be used to generate a fish completion string for the application. Relates to: #351 Signed-off-by: Sascha Grunert <sgrunert@suse.com> commit2e0e39a03bMerge:946f918aed704aAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Fri Aug 9 10:34:28 2019 +0530 Merge pull request #845 from urfave/lint-fixes linter fixes commit0d79d1d9d9Author: Sascha Grunert <sgrunert@suse.com> Date: Thu Aug 8 14:04:21 2019 +0200 Remove unused `Date` variable from `cliTemplate` Signed-off-by: Sascha Grunert <sgrunert@suse.com> commitaed704a9d0Merge:0990ca2946f918Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Thu Aug 8 14:44:02 2019 +0530 Merge branch 'master' into lint-fixes commit946f918365Merge:2c477e7286133fAuthor: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Thu Aug 8 09:13:09 2019 +0100 Merge pull request #735 from rliebz/combined Add app-wide support for combining short flags commit0990ca2391Merge:fdba7e02c477e7Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Thu Aug 8 13:36:30 2019 +0530 Merge branch 'master' into lint-fixes commit286133fee5Merge:815c29f2c477e7Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Thu Aug 8 13:33:32 2019 +0530 Merge branch 'master' into combined commit2c477e720eMerge:e0057bb99fad61Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Thu Aug 8 08:41:19 2019 +0100 Merge pull request #830 from saschagrunert/docs-gen Add markdown and man page docs generation methods commit99fad61dedMerge:40d4a25e0057bbAuthor: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Thu Aug 8 07:06:08 2019 +0100 Merge branch 'master' into docs-gen commite0057bb597Merge:521735bfd39578Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Thu Aug 8 07:04:25 2019 +0100 Merge pull request #846 from urfave/asahasrabuddhe-patch-1 Update README.md commit815c29ffc7Merge:a77c440521735bAuthor: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Thu Aug 8 07:03:49 2019 +0100 Merge branch 'master' into combined commitfd395786a2Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Aug 7 21:00:07 2019 +0530 Update README.md remove quotes around coverage badge commitfdba7e0f8cAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Wed Aug 7 20:14:50 2019 +0530 linter fixes code cleanup changing some test code to ensure uniformity commit40d4a25a01Author: Sascha Grunert <mail@saschagrunert.de> Date: Sat Aug 3 12:41:50 2019 +0200 Add markdown and man page docs generation methods This adds two new methods to the `App` struct: - `ToMarkdown`: creates a markdown documentation string - `ToMan`: creates a man page string Signed-off-by: Sascha Grunert <mail@saschagrunert.de> commit521735b760Merge:97179ca22e1fc8Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Wed Aug 7 12:10:34 2019 +0100 Merge pull request #844 from urfave/asahasrabuddhe-patch-1 Update README.md commit22e1fc8419Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Aug 7 14:02:52 2019 +0530 Update README.md add codecov.io badge commit97179ca390Merge:b6f7dd93a41d6dAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Aug 7 13:58:51 2019 +0530 Merge pull request #843 from lafriks/patch-1 Support GoLang 1.10 to 1.12 commit3a41d6d785Author: Lauris BH <lauris@nix.lv> Date: Wed Aug 7 11:21:31 2019 +0300 Lower support to GoLang compiler version 1.10 commit1f4473209dAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Aug 7 13:50:04 2019 +0530 Update .travis.yml support go versions in line with go's release policy commite3fa7e8566Author: Lauris BH <lauris@nix.lv> Date: Wed Aug 7 11:06:15 2019 +0300 Support also GoLang 1.11 compiler commitb6f7dd9359Merge:93392d1e2de8c7Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Aug 7 13:28:34 2019 +0530 Merge pull request #836 from urfave/flag-type-generation-golang Flag Generation in the CLI commite2de8c7458Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Wed Aug 7 12:38:17 2019 +0530 update readme with correct error message, add 1.12 and 1.11 to travis commita77c440b84Merge:8d31c5e93392d1Author: Robert Liebowitz <rliebz@gmail.com> Date: Tue Aug 6 22:33:49 2019 -0400 Merge branch 'master' into combined commit24de27b05eMerge:c19938f93392d1Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Wed Aug 7 01:54:44 2019 +0530 Merge branch 'master' into flag-type-generation-golang commitc19938fbbfAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Wed Aug 7 01:51:02 2019 +0530 update ci commands commit6ee5b89e03Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Wed Aug 7 01:50:50 2019 +0530 move build.go to root commite8bbb4c3b5Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Wed Aug 7 01:46:22 2019 +0530 remove unnecessary sprintf commit5070d00811Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Tue Aug 6 12:33:33 2019 +0530 move packages slice to global scope commit93392d12e8Merge:26945c51db0496Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Tue Aug 6 07:59:53 2019 +0100 Merge pull request #808 from yogeshlonkar/master Add support for flags bash completion commitadfe6a09c1Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Tue Aug 6 12:14:18 2019 +0530 indenting fix commit1db049685aAuthor: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Mon Aug 5 20:22:52 2019 +0200 Fix unused regex commit2be2bc755eAuthor: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Mon Aug 5 20:18:08 2019 +0200 Add additional test for log flag completion and comments commitc3f51bed6fAuthor: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Mon Aug 5 17:07:46 2019 +0200 Fix SC2199: Arrays implicitly concatenate in commitc5612e8cd2Author: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Mon Aug 5 16:58:04 2019 +0200 Fix review comments commit8d31c5e167Author: Robert Liebowitz <rliebz@gmail.com> Date: Mon Aug 5 07:05:07 2019 -0400 Update README.md Co-Authored-By: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> commit03153b9cf8Author: Robert Liebowitz <rliebz@gmail.com> Date: Mon Aug 5 06:16:30 2019 -0400 Allow combining short flags globally commitd6523cf869Merge:e949dc226945c5Author: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Mon Aug 5 11:00:26 2019 +0200 Merge branch 'master' into master commit26945c58edMerge:d09efb5c25e4caAuthor: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sun Aug 4 12:36:23 2019 -0700 Merge pull request #823 from xordspar0/master Make the exit code example more clear commitc25e4cab32Merge:b1a7c50d09efb5Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sun Aug 4 12:30:28 2019 -0700 Merge branch 'master' into master commitac5c97b418Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 20:45:28 2019 +0530 add latest assets file commit489d92d2e2Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 20:44:15 2019 +0530 add missing os package commita7f0d86509Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 20:33:21 2019 +0530 add zero mod fs back and commit file with latest ts commit798e1f3d3aAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 20:29:53 2019 +0530 fix spacing issue commit7a6f3d4394Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 20:23:32 2019 +0530 fix tests commit58ae5eb590Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 20:06:44 2019 +0530 move entire build system to go commit8547458f1dAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 19:01:47 2019 +0530 remove zero mod fs commitd09efb5fbdMerge:77450001327f58Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sun Aug 4 18:00:11 2019 +0530 Merge pull request #837 from urfave/codeowners Use codeowners instead of maintainers commit1327f58314Merge:9938dec7745000Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sun Aug 4 17:52:42 2019 +0530 Merge branch 'master' into codeowners commite949dc2cc0Merge:11c9e597745000Author: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Sun Aug 4 10:38:56 2019 +0200 Merge branch 'master' into master commit4b0a410463Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 12:26:48 2019 +0530 fix travis build commitfb4cea5f30Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 12:22:45 2019 +0530 add new generation logic to travis commit365557021fAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 12:17:27 2019 +0530 remove legacy version check code commitb6bfbe97f8Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 12:16:07 2019 +0530 update appveyor to go 1.11, add support for code coverage generation in tests commit826954c979Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 11:09:34 2019 +0530 update app name and remove version commit04948f2152Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 11:06:19 2019 +0530 generate test with go generate commit86e10211deAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 11:05:50 2019 +0530 remove redundant go generate from altsrc update go generate in cli package to generate both files regeneration test commitc676ed4caaAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 11:04:23 2019 +0530 indentation fixes in template regeneration test commitc4fc88e46dMerge:2a084949260850Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 10:29:34 2019 +0530 Merge branch 'flag-type-generation-golang' of https://github.com/urfave/cli into flag-type-generation-golang commit2a084945a4Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 10:28:08 2019 +0530 move around code change package to flag-gen to avoid conflict with flag-generator binary test code generation commit065fe9e9afAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 10:05:44 2019 +0530 change structure to embed source json and template files restructure code to have defaults in place of choices commitd1ded77768Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sun Aug 4 08:45:29 2019 +0530 rename utility from fg > flag-generator commit7745000a0eMerge:e6cf83e81acbebAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sun Aug 4 08:15:00 2019 +0530 Merge pull request #774 from whereswaldon/patch-1 Clarify that altsrc supports both TOML and JSON commit81acbeb629Merge:8abc5a2e6cf83eAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sun Aug 4 08:12:24 2019 +0530 Merge branch 'master' into patch-1 commite6cf83ec39Merge:244eba7eee6ce8Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Aug 3 19:37:52 2019 -0700 Merge pull request #829 from urfave/lynncyrin-patch-2 Release 1.21.0 commit8abc5a2e49Merge:b2421d1244eba7Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sun Aug 4 08:04:13 2019 +0530 Merge branch 'master' into patch-1 commit9938dec695Author: [[ BOT ]] Lynn Cyrin <lynncyrin@gmail.com> Date: Sat Aug 3 10:26:07 2019 -0700 update contributing docs commit97dbddb32dAuthor: [[ BOT ]] Lynn Cyrin <lynncyrin@gmail.com> Date: Sat Aug 3 10:23:29 2019 -0700 use codeowners instead of maintainers commit92608509a4Merge:d209be3244eba7Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sat Aug 3 22:49:24 2019 +0530 Merge branch 'master' into flag-type-generation-golang commitd209be3245Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sat Aug 3 22:32:36 2019 +0530 update go generate command test file generation commitadd69c7d4fAuthor: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sat Aug 3 22:16:25 2019 +0530 updated flag types generated courtesy fg cli commitc133a5aeb1Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sat Aug 3 22:15:43 2019 +0530 add explicit true/false choices for value and dest keys due to go default false for bool types commit16c7a60528Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sat Aug 3 22:14:58 2019 +0530 finish generation of flag types for altsrc package rename package to fg (flag generator) commit32ddef5ca7Author: Ajitem Sahasrabuddhe <ajitem.sahasrabuddhe@perennialsys.com> Date: Sat Aug 3 21:48:48 2019 +0530 finish generation of flag types for cli package commit9766be8d3eAuthor: mingrammer <mingrammer@gmail.com> Date: Thu Mar 7 00:04:18 2019 +0900 get latest changes from master commite01e3c540cAuthor: mingrammer <mingrammer@gmail.com> Date: Wed Mar 6 23:51:22 2019 +0900 Fix the unaligned indents for the commands that have no categories commitb1a7c502ebMerge:c75a689244eba7Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Aug 3 09:36:27 2019 -0700 Merge branch 'master' into master commiteee6ce83c0Merge:8a7f65e244eba7Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Aug 3 09:06:47 2019 -0700 Merge branch 'master' into lynncyrin-patch-2 commit11c9e598b0Merge:01ab016244eba7Author: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Sat Aug 3 15:52:08 2019 +0200 Merge branch 'master' into master commit244eba7e4cMerge:11699064627bbeAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sat Aug 3 18:04:31 2019 +0530 Merge pull request #831 from saschagrunert/go-modules Add go module support commitb2421d1235Merge:3e145071169906Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Sat Aug 3 13:25:34 2019 +0100 Merge branch 'master' into patch-1 commit4627bbe109Author: Sascha Grunert <mail@saschagrunert.de> Date: Sat Aug 3 12:55:06 2019 +0200 Add go module support This adds a go.{mod,sum} file to official support go modules. Signed-off-by: Sascha Grunert <mail@saschagrunert.de> commit1169906f57Merge:07c163894f4f83Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Sat Aug 3 11:02:34 2019 +0100 Merge pull request #773 from teresy/redundant-nil-check-slice Remove redundant nil checks commit94f4f83672Merge:da581b207c1638Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Sat Aug 3 02:05:33 2019 -0700 Merge branch 'master' into redundant-nil-check-slice commit07c1638969Merge:842e3fe7a51175Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sat Aug 3 08:47:32 2019 +0530 Merge pull request #806 from mingrammer/fix-help-indentation Fix the unaligned indents for the command help messages commit7a51175ce1Merge:330a914842e3feAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sat Aug 3 08:37:34 2019 +0530 Merge branch 'master' into fix-help-indentation commit842e3fe1b6Merge:7675649fa51d00Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Sat Aug 3 08:12:05 2019 +0530 Merge pull request #828 from urfave/lynncyrin-patch-1 Update maintainers for current reality commit8a7f65e052Author: Lynn Cyrin (they/them) <lynn@textio.com> Date: Fri Aug 2 19:30:41 2019 -0700 Update CHANGELOG.md commite8eac43d9dAuthor: Lynn Cyrin <lynn@textio.com> Date: Fri Aug 2 18:26:41 2019 -0700 Update CHANGELOG.md commit330a9143fbMerge:ddc34537675649Author: Lynn Cyrin <lynn@textio.com> Date: Fri Aug 2 18:14:50 2019 -0700 Merge branch 'master' into fix-help-indentation commitfa51d00dc6Author: Lynn Cyrin <lynn@textio.com> Date: Fri Aug 2 18:06:15 2019 -0700 Update maintainers for current reality commit01ab016427Merge:d79d2a07675649Author: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Fri Aug 2 22:03:55 2019 +0200 Merge branch 'master' into master commitc75a689f62Author: Jordan Christiansen <Jordan.Christiansen@target.com> Date: Fri Aug 2 14:28:57 2019 -0500 Make exit code example more clear The purpose of this example is to show that you can exit with an error code if a flag is unspecified, but with the code as it is, the only way to cause a non-zero exit is by adding the flag `--ginger-crouton=false`, which is not explained in the example. In this new version of the example, running the command with no flag will exit with an error, and running it with the flag will exit normally. commit7675649a17Merge:656063af8ba505Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Fri Aug 2 22:52:32 2019 +0530 Merge pull request #819 from lynncyrin/required-flags-take-2 Required flags commitf8ba505a7cMerge:60fb297656063aAuthor: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Fri Aug 2 22:49:29 2019 +0530 Merge branch 'master' into required-flags-take-2 commit656063a846Merge:693af586505336Author: Ajitem Sahasrabuddhe <ajitem.s@outlook.com> Date: Fri Aug 2 22:49:09 2019 +0530 Merge pull request #788 from benzvan/master adds test coverage to context commit60fb297232Author: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 23:27:34 2019 -0700 remove help assertion stuff commitd7ec4e8013Author: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 23:26:43 2019 -0700 add env var tests commitf4128a02f3Author: Lynn Cyrin <lynncyrin@gmail.com> Date: Thu Aug 1 22:54:15 2019 -0700 Update command.go commit38f9e1622dAuthor: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 22:52:21 2019 -0700 add environment variable support 🎉 commitf21b22dd90Author: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 22:10:18 2019 -0700 cleanup some issues with error display commitfdd4d10691Author: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 21:48:52 2019 -0700 update comments commitef9acb4a3bAuthor: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 21:46:56 2019 -0700 rename cases commit45f2b3d8e7Author: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 21:45:11 2019 -0700 more test cases commit78db152323Author: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 21:35:15 2019 -0700 add typed error assertions commitd4740d10d0Author: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 20:58:08 2019 -0700 more test cases commit595382c509Author: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 20:39:37 2019 -0700 expand test cases commit3d6eec825aAuthor: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 20:35:23 2019 -0700 add test cases commit7b9e16b6b5Author: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 20:30:43 2019 -0700 update test names commit95d3a8624dAuthor: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 20:27:51 2019 -0700 update test to reflect app flag usage commit714a73f028Author: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 19:57:14 2019 -0700 remove unused thing commit9438aba3b8Author: Lynn Cyrin <lynn@textio.com> Date: Thu Aug 1 19:54:57 2019 -0700 remove showFlagError, we can use the help printer assertion to accomplish the same goal commit386b379d19Author: Lynn Cyrin <lynn@textio.com> Date: Sun Jul 28 22:45:43 2019 -0700 Revert "reset generated flags changes" This reverts commit9ec594d529. commit9ec594d529Author: Lynn Cyrin <lynn@textio.com> Date: Sun Jul 28 22:34:07 2019 -0700 reset generated flags changes commit23f09ac1e8Author: Lynn Cyrin <lynn@textio.com> Date: Sun Jul 28 22:19:35 2019 -0700 cleanup tests, check required flags in more places commitd79d2a0424Author: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Wed Jul 24 16:08:47 2019 +0200 Fix issue with source command completion Avoid competion for bash builtin `source` and fallback to default implementation as it throws below error ``` -bash: source: --: invalid option source: usage: source filename [arguments] ``` commit7ce0af189eAuthor: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 18 00:52:24 2019 -0700 remove unused code commitd8985dc6d5Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 18 00:51:16 2019 -0700 reduce diff commit19140e1fb5Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 18 00:48:09 2019 -0700 show errors commit2299852c3cAuthor: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 18 00:47:18 2019 -0700 cleanup subcommand and specs commit300288670fAuthor: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 18 00:20:32 2019 -0700 add subcommand commitcc1cf8c459Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 18 00:09:07 2019 -0700 wording shift commit32d84d8e87Author: Lynn Cyrin <lynncyrin@gmail.com> Date: Wed Jul 17 00:25:13 2019 -0700 copy update commit01d5cfab70Author: Lynn Cyrin <lynn@textio.com> Date: Wed Jul 17 00:20:44 2019 -0700 use strings.Join commitcdc7af744eAuthor: Lynn Cyrin <lynn@textio.com> Date: Wed Jul 17 00:16:40 2019 -0700 add handling for multiple required flags commit9293f5b3ccAuthor: Lynn Cyrin <lynn@textio.com> Date: Sun Jul 14 21:00:16 2019 -0700 visually shorten logic commitf00f35ce8cAuthor: Lynn Cyrin <lynn@textio.com> Date: Sat Jul 13 14:02:45 2019 -0700 docs commit17108e1db4Author: Lynn Cyrin <lynn@textio.com> Date: Sat Jul 13 13:59:29 2019 -0700 tabs commitcf824804c2Author: Lynn Cyrin <lynn@textio.com> Date: Sat Jul 13 13:57:06 2019 -0700 update tests commit80d7e91191Author: Lynn Cyrin <lynn@textio.com> Date: Sat Jul 13 03:51:26 2019 -0700 fill out test cases commit746866c10dAuthor: Lynn Cyrin <lynn@textio.com> Date: Sat Jul 13 03:44:39 2019 -0700 add update integration with the help output commit550ed20ea4Author: Lynn Cyrin <lynn@textio.com> Date: Sat Jul 13 01:26:47 2019 -0700 update tests commitf6777bf4bfAuthor: Lynn Cyrin <lynn@textio.com> Date: Sat Jul 13 01:03:46 2019 -0700 quote the flag name commit6a2ae78373Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 21:53:10 2019 -0700 backwards compatible RequiredFlag implementation commit922d231891Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 21:28:09 2019 -0700 ./generate-flag-types cli -i flag-types.json -o flag_generated.go commit8a58b7e039Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:47:47 2019 -0700 remove manual isRequired funcs commit62e99ad1c1Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:46:22 2019 -0700 add IsRequired to generator commit310bfeb194Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:44:41 2019 -0700 add required attr to generator commitaf627c73c3Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:34:17 2019 -0700 update func name commit3d2d6975b4Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:32:42 2019 -0700 reduce diff commit0608059cc7Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:32:15 2019 -0700 reduce diff commit9c299e7e8aAuthor: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:28:29 2019 -0700 reduce diff commit30a71dc427Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:25:52 2019 -0700 update Run command commitf7d5e2c21eAuthor: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:22:16 2019 -0700 reduce diff commite6842c0b75Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:21:05 2019 -0700 merge in test file commitfa8187f2ceAuthor: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:19:42 2019 -0700 reduce diff commitce1630141eAuthor: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:18:52 2019 -0700 reduce diff??? commit138dbaafecMerge:aba73ce693af58Author: Lynn Cyrin <lynn@textio.com> Date: Thu Jul 11 20:07:55 2019 -0700 Merge branch 'master' into required_flags commitda581b24e8Merge:6aa7f35693af58Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Fri Jun 28 07:55:04 2019 +0100 Merge branch 'master' into redundant-nil-check-slice commit65053360c7Author: Ben Zvan <ben.zvan@target.com> Date: Wed Jun 26 09:41:11 2019 -0500 Revert "Created using Colaboratory" This reverts commit83b99c4109. This commit was randomly created here when I connected to colaboratory commit83b99c4109Author: Ben Zvan <ben@zvan.net> Date: Tue Jun 25 18:47:58 2019 -0500 Created using Colaboratory commit23042d3707Merge:4a76377693af58Author: Ben Zvan <ben@zvan.net> Date: Fri Jun 14 10:14:07 2019 -0500 Merge branch 'master' into master commit62f02f21efAuthor: Yogesh Lonkar <ylonkar@whitehedge.com> Date: Thu Apr 11 10:57:58 2019 +0530 Don't complete hidden flags commit1d7a2b08d6Author: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Thu Mar 21 13:01:48 2019 +0530 Add default completion on commands, test cases, refactor code commitfb1421d903Author: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Wed Mar 20 21:34:56 2019 +0530 Fix duplicate completion of existing flag commit58a072d573Author: Yogesh Lonkar <lonkar.yogeshr@gmail.com> Date: Wed Mar 20 20:28:51 2019 +0530 Add bash completion support for flags commitddc3453179Author: mingrammer <mingrammer@gmail.com> Date: Thu Mar 7 00:04:18 2019 +0900 Update README.md commita0453b2200Author: mingrammer <mingrammer@gmail.com> Date: Wed Mar 6 23:51:22 2019 +0900 Fix the unaligned indents for the commands that have no categories commit693af58b4dMerge:e229212d7c3be8Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Sun Feb 3 18:40:40 2019 +0000 Merge pull request #766 from agis/patch-1 Fix README typo commit6aa7f352faMerge:21dfc6ee229212Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Sun Feb 3 18:39:49 2019 +0000 Merge branch 'master' into redundant-nil-check-slice commite229212769Merge:b67dcf95b83c89Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Sun Feb 3 18:37:18 2019 +0000 Merge pull request #798 from Quasilyte/patch-1 use type switch instead of if/else commit5b83c895a7Author: Iskander (Alex) Sharipov <quasilyte@gmail.com> Date: Tue Jan 29 22:51:02 2019 +0300 use type switch instead of if/else This reduces the syntax noise of the code by removing excessive type assertions. Signed-off-by: Iskander Sharipov <quasilyte@gmail.com> commit4a76377775Author: Ben Zvan <benjamin.zvan@target.com> Date: Wed Dec 26 12:48:12 2018 -0600 go fmt commitd63733fe14Author: Ben Zvan <benjamin.zvan@target.com> Date: Wed Dec 26 12:41:27 2018 -0600 adds test coverage to context commitb67dcf995bMerge:cbebba911ab68fAuthor: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Mon Oct 29 21:32:00 2018 +0000 Merge pull request #776 from gliptak/patch-2 Bring Go version current commit11ab68f24dMerge:769f6d5cbebba9Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Mon Oct 29 21:19:45 2018 +0000 Merge branch 'master' into patch-2 commitcbebba941bMerge:934abfb9587fc2Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Mon Oct 29 21:18:40 2018 +0000 Merge pull request #775 from gliptak/patch-1 Correct typo commit769f6d543bAuthor: Gábor Lipták <gliptak@gmail.com> Date: Thu Oct 18 21:00:02 2018 -0400 Bring Go version current commit9587fc27bdAuthor: Gábor Lipták <gliptak@gmail.com> Date: Thu Oct 18 20:56:13 2018 -0400 Correct typo commit3e145076abAuthor: Christopher Waldon <christopher.waldon.dev@gmail.com> Date: Fri Oct 12 11:30:46 2018 -0400 Clarify that altsrc supports both TOML and JSON commit21dfc6eb83Author: teresy <hi.teresy@gmail.com> Date: Wed Oct 10 14:54:48 2018 -0400 Remove redundant nil checks commitd7c3be8267Author: Agis Anastasopoulos <827224+agis@users.noreply.github.com> Date: Tue Aug 21 11:19:37 2018 +0300 Fix README typo commit934abfb2f1Merge:8e01ec43e5a935Author: Audrius Butkevicius <audrius.butkevicius@gmail.com> Date: Tue Aug 21 07:40:27 2018 +0100 Merge pull request #758 from vrothberg/fix-short-opts-parsing short opt handling: fix parsing commit3e5a935ed3Author: Valentin Rothberg <vrothberg@suse.com> Date: Tue Aug 21 08:33:42 2018 +0200 fix `go vet` warning command_test.go:342:3 value declared but not used Signed-off-by: Valentin Rothberg <vrothberg@suse.com> commitc23dfba701Author: Valentin Rothberg <vrothberg@suse.com> Date: Thu Jun 28 16:41:02 2018 +0200 short opt handling: fix parsing Only split a given string (e.g., "-abc") into short options (e.g., "-a", "-b", "-c") if all those are flags. To further avoid mistakenly transform common arguments, catch "flag provided but not defined" errors to iteratively transform short options. Signed-off-by: Valentin Rothberg <vrothberg@suse.com> Fixes: https://github.com/projectatomic/libpod/issues/714 commit8e01ec4cd3Merge:d4bf9ce8dc47ebAuthor: Dan Buch <dan@meatballhat.com> Date: Sun Feb 25 22:02:53 2018 -0500 Merge pull request #598 from urfave/backport-json-support Backport JSON InputSource to v1 commit8dc47eb3cbMerge:f551359d4bf9ceAuthor: Dan Buch <dan@meatballhat.com> Date: Sun Feb 25 16:09:48 2018 -0500 Merge branch 'master' into backport-json-support commitd4bf9ce860Merge:b09aafde59e474Author: Dan Buch <dan@meatballhat.com> Date: Sun Feb 25 16:09:04 2018 -0500 Merge pull request #498 from urfave/merging-jereksel-zsh Merging #489 (plus hack) commite59e4743b8Merge:5fc8124b09aafdAuthor: Dan Buch <dan@meatballhat.com> Date: Sat Feb 24 22:02:40 2018 -0500 Merge branch 'master' into merging-jereksel-zsh commitb09aafdfe9Merge:446f49ebc77a15Author: Dan Buch <dan@meatballhat.com> Date: Sat Feb 24 22:02:19 2018 -0500 Merge pull request #681 from urfave/check-run-error-in-readme Update README examples to check for errors commit5fc8124af1Merge:688c5a9446f49eAuthor: Dan Buch <dan@meatballhat.com> Date: Sat Feb 24 21:58:26 2018 -0500 Merge branch 'master' into merging-jereksel-zsh commitbc77a15c69Merge:59e1ddb446f49eAuthor: Dan Buch <dan@meatballhat.com> Date: Sat Feb 24 21:54:06 2018 -0500 Merge branch 'master' into check-run-error-in-readme commit446f49e78fMerge:a1c740845289eaAuthor: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Tue Feb 20 21:16:31 2018 -0800 Merge pull request #715 from urfave/maintainers-notice Adjust contribution and maintainer prose per current reality commit45289ea7a0Author: Dan Buch <dan@meatballhat.com> Date: Tue Feb 20 12:40:43 2018 -0500 Adjust contribution and maintainer prose per current reality commit59e1ddb43eMerge:9838c8ba1c7408Author: Dan Buch <dan@meatballhat.com> Date: Tue Feb 13 15:27:04 2018 -0500 Merge branch 'master' into check-run-error-in-readme commita1c7408de3Merge:803d0663a87b13Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Sat Feb 10 18:18:39 2018 -0800 Merge pull request #712 from windler/fix_args_reorder Fix args reordering when bool flags are present commit3a87b13b01Author: Nico Windler <nico.windler@gmail.com> Date: Sat Feb 10 13:35:23 2018 +0100 Fix args reordering when bool flags are present commit803d066579Merge:75104e9d7555e1Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Fri Feb 2 13:13:18 2018 -0800 Merge pull request #704 from dolmen/replace-unneeded-Sprintf Fix unnecessary uses of Sprintf commitd7555e1729Author: Olivier Mengué <dolmen@cpan.org> Date: Fri Jan 26 21:14:34 2018 +0100 Fix unnecessary uses of Sprintf - use strconv directly - use concatenation for "%s%s" commit75104e932aMerge:39908ebe38e4aeAuthor: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Sat Jan 6 11:10:48 2018 -0800 Merge pull request #697 from urfave/fix-skip-flag-parsing Fix regression of SkipFlagParsing behavior commite38e4ae2d0Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Fri Dec 29 13:38:18 2017 -0500 Fix regression of SkipFlagParsing behavior Introduced bydf562bf1a8Was mistakenly prepending the command name. commit39908eb08fMerge:119bb652610681Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Tue Dec 12 08:34:29 2017 -0800 Merge pull request #691 from urfave/refactor-686 Refactor flag handling logic commit2610681040Merge:0671b16119bb65Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Mon Dec 11 18:51:46 2017 -0800 Merge branch 'master' into refactor-686 commit0671b166dcAuthor: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Mon Dec 4 09:23:40 2017 -0800 Add tests for flag reordering commit119bb65648Merge:c9eba3fc6eb2a0Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Sun Dec 3 13:42:37 2017 -0800 Merge pull request #690 from gliptak/patch-1 Correct go vet for Go tip commitdf562bf1a8Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Sun Dec 3 13:38:50 2017 -0800 Refactor flag handling logic Refactor logic introduced by #686 commitc9eba3f37aMerge:c6af884ceaac7cAuthor: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Sun Dec 3 12:48:28 2017 -0800 Merge pull request #686 from baude/shortoptionSkipArg Handle ShortOptions and SkipArgReorder commitc6eb2a0510Author: Gábor Lipták <gliptak@gmail.com> Date: Thu Nov 30 19:43:12 2017 -0500 Correct go vet for Go tip https://travis-ci.org/cloudflare/logshare/jobs/309796141#L646 commitceaac7c915Author: baude <bbaude@redhat.com> Date: Mon Nov 20 09:32:03 2017 -0600 Handle ShortOptions and SkipArgReorder There was a bug in parsing when both ShortOptions and SkipArgReorder were being used together. Signed-off-by: baude <bbaude@redhat.com> commitc6af8847ebMerge:7ace96b37b7abbAuthor: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Mon Nov 27 19:55:04 2017 -0800 Merge pull request #687 from joshuarubin/master Don't clobber slices with EnvVar commit37b7abb1c4Author: Joshua Rubin <jrubin@zvelo.com> Date: Tue Nov 21 15:21:31 2017 -0700 dont clobber slices with envvar Signed-off-by: Joshua Rubin <jrubin@zvelo.com> commit7ace96b43dMerge:44cb242fd5382eAuthor: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Wed Nov 15 20:56:12 2017 -0800 Merge pull request #684 from baude/shortOptionHandling Combine bool short names commitfd5382e7a5Author: baude <bbaude@redhat.com> Date: Mon Nov 13 15:28:23 2017 -0600 Combine bool short names Adds the ability to allow the combination of bool short-name options. For example, cmd foobar -ov This is done through a bool "UseShortOptionHandler" set in the command struct. Built upon PR #621 Signed-off-by: baude <bbaude@redhat.com> commit9838c8bcaaAuthor: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Sat Nov 11 16:23:24 2017 -0800 Update README examples to check for errors To encourage good practices. commit43c8c02cf5Author: zhuchensong <zhuchensong93@163.com> Date: Mon Apr 17 00:47:04 2017 +0800 Support POSIX-style short flag combining commit44cb242eebMerge:7f4b273f971fcaAuthor: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Fri Nov 3 19:35:40 2017 -0700 Merge pull request #675 from jmccann/continue3 Ability to load variable from file - UPDATED commitf971fca2b2Author: Jacob McCann <jacob.mccann2@target.com> Date: Thu Oct 26 13:08:03 2017 -0500 Allow FilePath to take []string commit18a556e192Author: Brad Rydzewski <brad.rydzewski@gmail.com> Date: Mon Apr 10 16:45:51 2017 +0200 fix FilePath documentation in README.md commit4cc453ba67Author: Brad Rydzewski <brad.rydzewski@gmail.com> Date: Sat Apr 1 12:55:46 2017 +0900 document field in README commitc698b821b8Author: Brad Rydzewski <brad.rydzewski@gmail.com> Date: Sat Apr 1 12:37:06 2017 +0900 unit tests for load from file commit21fcab0deeAuthor: Brad Rydzewski <brad.rydzewski@gmail.com> Date: Fri Mar 31 16:24:15 2017 +0900 ability to load variable from file commit7f4b273a05Merge:7bc6a0ab44660aAuthor: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Mon Oct 30 19:55:34 2017 -0700 Merge pull request #676 from rliebz/lexicographic-sort Consider case when sorting strings commitb44660ac3dAuthor: Robert Liebowitz <rliebz@gmail.com> Date: Sat Oct 28 03:00:11 2017 -0400 Consider case when sorting strings This makes sorting flags and other sections consistent with how most command line tools function, by placing both flags `-A` and `-a` before a flag `-B`. commit7bc6a0acffMerge:299750040263f4Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Sat Oct 14 13:27:26 2017 -0700 Merge pull request #628 from phinnaeus/master Allow custom ExitError handler function commit40263f4d6aMerge:7233c502997500Author: Tyler Davis <phinnaeus@users.noreply.github.com> Date: Fri Oct 13 12:05:14 2017 -0700 Merge branch 'master' into master commit2997500ba5Merge:ac24947c202606Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Sat Oct 7 13:56:23 2017 -0700 Merge pull request #672 from sierraechobravo/master fix go report card issues commitc202606a17Author: Sebastian Sprenger <Sebastian.Sprenger@booxware.de> Date: Fri Oct 6 07:29:13 2017 +0200 fix golint issues commitc3cc74dac7Author: Sebastian Sprenger <Sebastian.Sprenger@booxware.de> Date: Fri Oct 6 07:28:43 2017 +0200 fix ineffective assigns commit67ee172e6dAuthor: Sebastian Sprenger <Sebastian.Sprenger@booxware.de> Date: Fri Oct 6 07:28:18 2017 +0200 fix misspelling issue commitac249472b7Merge:7fb9c86cbbe4c1Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Mon Sep 25 20:41:18 2017 -0700 Merge pull request #661 from rliebz/custom-flag-help Allow customization of prefixes and environment variable hints in flag help strings commit7233c502e3Merge:5dc55f27fb9c86Author: Tyler Davis <phinnaeus@users.noreply.github.com> Date: Fri Sep 22 10:08:36 2017 -0700 Merge branch 'master' into master commitcbbe4c1a2cAuthor: Robert Liebowitz <rliebz@gmail.com> Date: Mon Sep 18 00:44:42 2017 -0400 Add tests for custom flag prefix/env hints commit11d45572f9Author: rliebz <rliebz@gmail.com> Date: Sat Aug 26 07:42:25 2017 -0400 Export funcs to configure flag prefix/env hints This will allow users to customize the prefix section or env hint section of the flag entries in the help menu without having to reimplement the rest of the logic required in defining FlagStringer. commit7fb9c86b14Merge:f017f861d334f1Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Sun Sep 10 21:08:19 2017 -0700 Merge pull request #664 from maguro/master Add newline before command categories commit1d334f10ceAuthor: Alan D. Cabrera <adc@toolazydogs.com> Date: Fri Sep 8 10:37:48 2017 -0700 Add newline before command categories The simple formatting change adds a nice blank line before each command category. Documentation in README.md is also updated to be more accurate. commit5dc55f2287Merge:10e81baf017f86Author: Dan Buch <dan@meatballhat.com> Date: Sun Aug 13 12:42:49 2017 -0400 Merge branch 'master' into master commitf017f86fccMerge:cfb388344c6487Author: Dan Buch <dan@meatballhat.com> Date: Sun Aug 13 10:59:49 2017 -0400 Merge pull request #659 from urfave/define-flag-precedence Define flag source precedence in README commit44c648739bMerge:e1fa109cfb3883Author: Dan Buch <dan@meatballhat.com> Date: Sun Aug 13 10:54:04 2017 -0400 Merge branch 'master' into define-flag-precedence commitcfb3883072Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Thu Aug 10 18:42:03 2017 -0700 Prepare CHANGELOG for v1.20.0 release commitf5513590f5Merge:6a70c4cb99aa81Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Thu Aug 10 18:06:12 2017 -0700 Merge branch 'master' into backport-json-support commite1fa109a31Author: Jesse Szwedko <jesse.szwedko@gmail.com> Date: Thu Aug 10 17:54:24 2017 -0700 Define flag source precedence in README Fixes #646 commit688c5a9d4fMerge:7250c974b90d79Author: Dan Buch <dan@meatballhat.com> Date: Thu Aug 3 14:38:20 2017 -0400 Merge branch 'master' into merging-jereksel-zsh commit10e81bacd1Merge:5d528e24b90d79Author: Tyler Davis <phinnaeus@users.noreply.github.com> Date: Thu Jul 20 12:44:56 2017 -0700 Merge branch 'master' into master commit5d528e2052Author: Tyler Davis <tyler.davis@gmail.com> Date: Wed Jun 28 13:04:09 2017 -0700 use exit errors in uts commit58450552eeAuthor: Tyler Davis <tyler.davis@gmail.com> Date: Wed Jun 28 12:52:50 2017 -0700 Add Test commit71bdf81f5aAuthor: Tyler Davis <tyler.davis@gmail.com> Date: Wed Jun 28 10:10:11 2017 -0700 sigh... fix one more named parameter issue commit172bb92059Author: Tyler Davis <tyler.davis@gmail.com> Date: Wed Jun 28 10:07:25 2017 -0700 fix named parameter issue commit530df59178Author: Tyler Davis <tyler.davis@gmail.com> Date: Wed Jun 28 09:52:12 2017 -0700 Pass context into handleExitCoder commit9d61cbad02Author: Tyler Davis <phinnaeus@users.noreply.github.com> Date: Tue Apr 25 12:45:08 2017 -0700 Updated command.go to use App handleExitCoder commitceee6408d5Author: Tyler Davis <tyler.davis@gmail.com> Date: Tue Apr 25 13:02:05 2017 -0700 Revert "Fix how to do defaults in app.go" This reverts commit 8906567dc2ad52fd31c50cf02fa606505a1323ba. commit80b09a4d11Author: Tyler Davis <phinnaeus@users.noreply.github.com> Date: Tue Apr 25 11:20:41 2017 -0700 Fix how to do defaults in app.go commit827da610b4Author: Tyler Davis <phinnaeus@users.noreply.github.com> Date: Tue Apr 25 09:33:54 2017 -0700 Add a bit more documentation commit538742687bAuthor: Tyler Davis <phinnaeus@users.noreply.github.com> Date: Tue Apr 25 09:31:53 2017 -0700 Add ExitErrHandlerFunc type commitc48a829640Author: Tyler Davis <phinnaeus@users.noreply.github.com> Date: Tue Apr 25 09:29:43 2017 -0700 Allow custom exit err handlers commit6a70c4cc92Author: John Weldon <johnweldon4@gmail.com> Date: Sat Jul 2 12:35:48 2016 -0700 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 commit7250c97913Merge:363d9c90bdeddeAuthor: Dan Buch <dan@meatballhat.com> Date: Wed Dec 21 15:11:00 2016 -0500 Merge branch 'master' into merging-jereksel-zsh commit363d9c9a31Author: Dan Buch <daniel.buch@gmail.com> Date: Sun Jul 24 17:29:13 2016 -0400 Add a hack so that zsh completion only runs for zsh commit1cbb9a7f30Merge:e43a9fbceeebabAuthor: Dan Buch <daniel.buch@gmail.com> Date: Sun Jul 24 17:12:43 2016 -0400 Merge branch 'zsh' of https://github.com/jereksel/cli into jereksel-zsh commitceeebaba04Author: Andrzej Ressel <jereksel@gmail.com> Date: Thu Jul 21 00:02:16 2016 +0200 [PoC] Improve zsh autocompletions commitaba73cedacAuthor: jhowarth <jhowarth@riotgames.com> Date: Tue Mar 3 14:02:42 2015 -0800 Copy the writer of the App to the subcommand App commita6482d2687Merge:b5844af50c77ecAuthor: jhowarth <jhowarth@riotgames.com> Date: Mon Mar 2 15:21:01 2015 -0800 Merge remote-tracking branch 'upstream/master' Conflicts: app.go command.go flag.go commitb5844af298Merge:8f1fb06145da32Author: Jesse Howarth <jahowarth@gmail.com> Date: Mon Mar 2 14:53:57 2015 -0800 Merge pull request #2 from ivey/requiredFlags Required flags commit145da3210fAuthor: jhowarth <jhowarth@riotgames.com> Date: Mon Mar 2 12:06:42 2015 -0800 don't require flags when the help flag is included commit6023f370c1Author: jhowarth <jhowarth@riotgames.com> Date: Mon Mar 2 12:00:21 2015 -0800 dry error messages commite67e05f617Author: jhowarth <jhowarth@riotgames.com> Date: Mon Mar 2 11:56:29 2015 -0800 DRY error handling commitcbd95292acAuthor: jhowarth <jhowarth@riotgames.com> Date: Mon Mar 2 11:18:59 2015 -0800 Remove debugging commit8f1fb06a58Merge:9908e964b2fcdbAuthor: Jesse Howarth <jahowarth@gmail.com> Date: Tue Dec 2 15:23:01 2014 -0800 Merge pull request #1 from ivey/required_flags Required flags commit4b2fcdb1adAuthor: Jesse Howarth and Michael Ivey <datdevs+jhowarth+michael.ivey@riotgames.com> Date: Tue Dec 2 21:08:24 2014 +0000 Add tests for required flags commit73e64a14fdAuthor: Jesse Howarth and Michael Ivey <datdevs+jhowarth+michael.ivey@riotgames.com> Date: Tue Dec 2 19:02:56 2014 +0000 Add (required) to help of flags that are required. commit7e05320026Author: Jesse Howarth and Michael Ivey <datdevs+jhowarth+michael.ivey@riotgames.com> Date: Tue Dec 2 17:44:55 2014 +0000 Implement required flags
cli
cli is a simple, fast, and fun package for building command line apps in Go. The goal is to enable developers to write fast and distributable command line applications in an expressive way.
- Overview
- Installation
- Getting Started
- Examples
master + Enabling + Distribution + Customization
Overview
Command line apps are usually so tiny that there is absolutely no reason why your code should not be self-documenting. Things like generating help text and parsing command flags/options should not hinder productivity when writing a command line app.
This is where cli comes into play. cli makes command line programming fun, organized, and expressive!
Installation
Make sure you have a working Go environment. Go version 1.10+ is supported. See the install instructions for Go.
To install cli, simply run:
$ go get github.com/urfave/cli/v2
Make sure your PATH includes the $GOPATH/bin directory so your commands can
be easily used:
export PATH=$PATH:$GOPATH/bin
Supported platforms
cli is tested against multiple versions of Go on Linux, and against the latest
released version of Go on OS X and Windows. For full details, see
./.travis.yml and ./appveyor.yml.
Using the v2 branch
Warning: The v2 branch is currently unreleased and considered unstable.
There is currently a long-lived branch named v2 that is intended to land as
the new master branch once development there has settled down. The current
master branch (mirrored as v1) is being manually merged into v2 on
an irregular human-based schedule, but generally if one wants to "upgrade" to
v2 now and accept the volatility (read: "awesomeness") that comes along with
that, please use:
$ go get github.com/urfave/cli/v2
...
import (
"github.com/urfave/cli/v2" // imports as package "cli"
)
...
<<<<<<< HEAD NOTE: There is a migrator (python) script available to aid with the transition from the v1 to v2 API.
Pinning to the v1 releases
Similarly to the section above describing use of the v2 branch, if one wants
to avoid any unexpected compatibility pains once v2 becomes master, then
pinning to v1 is an acceptable option, e.g.:
Using v1 releases
master
$ go get github.com/urfave/cli
...
import (
"github.com/urfave/cli/v2"
)
...
Getting Started
One of the philosophies behind cli is that an API should be playful and full of
discovery. So a cli app can be as little as one line of code in main().
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
(&cli.App{}).Run(os.Args)
}
This app will run and show help text, but is not very useful. Let's give an action to execute and some help documentation:
package main
import (
"fmt"
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: "boom",
Usage: "make an explosive entrance",
Action: func(c *cli.Context) error {
fmt.Println("boom! I say!")
return nil
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Running this already gives you a ton of functionality, plus support for things like subcommands and flags, which are covered below.
Examples
Being a programmer can be a lonely job. Thankfully by the power of automation that is not the case! Let's create a greeter app to fend off our demons of loneliness!
Start by creating a directory named greet, and within it, add a file,
greet.go with the following code in it:
package main
import (
"fmt"
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: "greet",
Usage: "fight the loneliness!",
Action: func(c *cli.Context) error {
fmt.Println("Hello friend!")
return nil
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Install our command to the $GOPATH/bin directory:
$ go install
Finally run our new command:
$ greet
Hello friend!
cli also generates neat help text:
$ greet help
NAME:
greet - fight the loneliness!
USAGE:
greet [global options] command [command options] [arguments...]
VERSION:
0.0.0
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS
--version Shows version information
Arguments
You can lookup arguments by calling the Args function on cli.Context, e.g.:
package main
import (
"fmt"
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Action: func(c *cli.Context) error {
fmt.Printf("Hello %q", c.Args().Get(0))
return nil
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Flags
Setting and querying flags is simple.
package main
import (
"fmt"
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Flags: []cli.Flag {
&cli.StringFlag{
Name: "lang",
Value: "english",
Usage: "language for the greeting",
},
},
Action: func(c *cli.Context) error {
name := "Nefertiti"
if c.NArg() > 0 {
name = c.Args().Get(0)
}
if c.String("lang") == "spanish" {
fmt.Println("Hola", name)
} else {
fmt.Println("Hello", name)
}
return nil
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
You can also set a destination variable for a flag, to which the content will be scanned.
package main
import (
"log"
"os"
"fmt"
"github.com/urfave/cli/v2"
)
func main() {
var language string
app := &cli.App{
Flags: []cli.Flag {
&cli.StringFlag{
Name: "lang",
Value: "english",
Usage: "language for the greeting",
Destination: &language,
},
},
Action: func(c *cli.Context) error {
name := "someone"
if c.NArg() > 0 {
name = c.Args().Get(0)
}
if language == "spanish" {
fmt.Println("Hola", name)
} else {
fmt.Println("Hello", name)
}
return nil
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
See full list of flags at http://godoc.org/github.com/urfave/cli
Placeholder Values
Sometimes it's useful to specify a flag's value within the usage string itself. Such placeholders are indicated with back quotes.
For example this:
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "Load configuration from `FILE`",
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Will result in help output like:
--config FILE, -c FILE Load configuration from FILE
Note that only the first placeholder is used. Subsequent back-quoted words will be left as-is.
Alternate Names
You can set alternate (or short) names for flags by providing a comma-delimited
list for the Name. e.g.
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Flags: []cli.Flag {
&cli.StringFlag{
Name: "lang",
Aliases: []string{"l"},
Value: "english",
Usage: "language for the greeting",
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
That flag can then be set with --lang spanish or -l spanish. Note that
giving two different forms of the same flag in the same command invocation is an
error.
Ordering
Flags for the application and commands are shown in the order they are defined.
However, it's possible to sort them from outside this library by using FlagsByName
or CommandsByName with sort.
For example this:
package main
import (
"log"
"os"
"sort"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Flags: []cli.Flag{
&cli.StringFlag{
Name: "lang, l",
Value: "english",
Usage: "Language for the greeting",
},
&cli.StringFlag{
Name: "config, c",
Usage: "Load configuration from `FILE`",
},
},
Commands: []*cli.Command{
{
Name: "complete",
Aliases: []string{"c"},
Usage: "complete a task on the list",
Action: func(c *cli.Context) error {
return nil
},
},
{
Name: "add",
Aliases: []string{"a"},
Usage: "add a task to the list",
Action: func(c *cli.Context) error {
return nil
},
},
},
}
sort.Sort(cli.FlagsByName(app.Flags))
sort.Sort(cli.CommandsByName(app.Commands))
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Will result in help output like:
--config FILE, -c FILE Load configuration from FILE
--lang value, -l value Language for the greeting (default: "english")
Values from the Environment
You can also have the default value set from the environment via EnvVars. e.g.
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Flags: []cli.Flag {
&cli.StringFlag{
Name: "lang",
Aliases: []string{"l"},
Value: "english",
Usage: "language for the greeting",
EnvVars: []string{"APP_LANG"},
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
If EnvVars contains more than one string, the first environment variable that
resolves is used as the default.
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Flags: []cli.Flag{
&cli.StringFlag{
Name: "lang",
Aliases: []string{"l"},
Value: "english",
Usage: "language for the greeting",
EnvVars: []string{"LEGACY_COMPAT_LANG", "APP_LANG", "LANG"},
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Values from files
You can also have the default value set from file via FilePath. e.g.
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := cli.NewApp()
app.Flags = []cli.Flag {
cli.StringFlag{
Name: "password, p",
Usage: "password for the mysql database",
FilePath: "/etc/mysql/password",
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Note that default values set from file (e.g. FilePath) take precedence over
default values set from the environment (e.g. EnvVar).
Values from alternate input sources (YAML, TOML, and others)
There is a separate package altsrc that adds support for getting flag values from other file input sources.
Currently supported input source formats:
- YAML
- JSON
- TOML
In order to get values for a flag from an alternate input source the following code would be added to wrap an existing cli.Flag like below:
altsrc.NewIntFlag(&cli.IntFlag{Name: "test"})
Initialization must also occur for these flags. Below is an example initializing getting data from a yaml file below.
command.Before = altsrc.InitInputSourceWithContext(command.Flags, NewYamlSourceFromFlagFunc("load"))
The code above will use the "load" string as a flag name to get the file name of a yaml file from the cli.Context. It will then use that file name to initialize the yaml input source for any flags that are defined on that command. As a note the "load" flag used would also have to be defined on the command flags in order for this code snipped to work.
Currently only YAML, JSON, and TOML files are supported but developers can add support for other input sources by implementing the altsrc.InputSourceContext for their given sources.
Here is a more complete sample of a command using YAML support:
package notmain
import (
"fmt"
"log"
"os"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v2/altsrc"
)
func main() {
flags := []cli.Flag{
altsrc.NewIntFlag(&cli.IntFlag{Name: "test"}),
&cli.StringFlag{Name: "load"},
}
app := &cli.App{
Action: func(c *cli.Context) error {
fmt.Println("yaml ist rad")
return nil
},
Before: altsrc.InitInputSourceWithContext(flags, altsrc.NewYamlSourceFromFlagFunc("load")),
Flags: flags,
}
app.Run(os.Args)
}
Default Values for help output
Sometimes it's useful to specify a flag's default help-text value within the flag declaration. This can be useful if the default value for a flag is a computed value. The default value can be set via the DefaultText struct field.
For example this:
package main
import (
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Flags: []cli.Flag{
&cli.IntFlag{
Name: "port",
Usage: "Use a randomized port",
Value: 0,
DefaultText: "random",
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Will result in help output like:
--port value Use a randomized port (default: random)
Precedence
The precedence for flag value sources is as follows (highest to lowest):
- Command line flag value from user
- Environment variable (if specified)
- Configuration file (if specified)
- Default defined on the flag
Subcommands
Subcommands can be defined for a more git-like command line app.
package main
import (
"fmt"
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Commands: []*cli.Command{
{
Name: "add",
Aliases: []string{"a"},
Usage: "add a task to the list",
Action: func(c *cli.Context) error {
fmt.Println("added task: ", c.Args().First())
return nil
},
},
{
Name: "complete",
Aliases: []string{"c"},
Usage: "complete a task on the list",
Action: func(c *cli.Context) error {
fmt.Println("completed task: ", c.Args().First())
return nil
},
},
{
Name: "template",
Aliases: []string{"t"},
Usage: "options for task templates",
Subcommands: []*cli.Command{
{
Name: "add",
Usage: "add a new template",
Action: func(c *cli.Context) error {
fmt.Println("new task template: ", c.Args().First())
return nil
},
},
{
Name: "remove",
Usage: "remove an existing template",
Action: func(c *cli.Context) error {
fmt.Println("removed task template: ", c.Args().First())
return nil
},
},
},
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Subcommands categories
For additional organization in apps that have many subcommands, you can associate a category for each command to group them together in the help output.
E.g.
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Commands: []*cli.Command{
{
Name: "noop",
},
{
Name: "add",
Category: "template",
},
{
Name: "remove",
Category: "template",
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Will include:
COMMANDS:
noop
Template actions:
add
remove
Exit code
Calling App.Run will not automatically call os.Exit, which means that by
default the exit code will "fall through" to being 0. An explicit exit code
may be set by returning a non-nil error that fulfills cli.ExitCoder, or a
cli.MultiError that includes an error that fulfills cli.ExitCoder, e.g.:
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "ginger-crouton",
Value: true,
Usage: "is it in the soup?",
},
},
Action: func(ctx *cli.Context) error {
if !ctx.Bool("ginger-crouton") {
return cli.Exit("it is not in the soup", 86)
}
return nil
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Combining short options
Traditional use of options using their shortnames look like this:
$ cmd -s -o -m "Some message"
Suppose you want users to be able to combine options with their shortnames. This
can be done using the UseShortOptionHandling bool in your app configuration,
or for individual commands by attaching it to the command configuration. For
example:
package main
import (
"fmt"
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{}
app.UseShortOptionHandling = true
app.Commands = []*cli.Command{
{
Name: "short",
Usage: "complete a task on the list",
Flags: []cli.Flag{
cli.BoolFlag{Name: "serve, s"},
cli.BoolFlag{Name: "option, o"},
cli.StringFlag{Name: "message, m"},
},
Action: func(c *cli.Context) error {
fmt.Println("serve:", c.Bool("serve"))
fmt.Println("option:", c.Bool("option"))
fmt.Println("message:", c.String("message"))
return nil
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
If your program has any number of bool flags such as serve and option, and
optionally one non-bool flag message, with the short options of -s, -o,
and -m respectively, setting UseShortOptionHandling will also support the
following syntax:
$ cmd -som "Some message"
If you enable UseShortOptionHandling, then you must not use any flags that
have a single leading - or this will result in failures. For example,
-option can no longer be used. Flags with two leading dashes (such as
--options) are still valid.
Bash Completion
You can enable completion commands by setting the EnableBashCompletion
flag on the App object. By default, this setting will only auto-complete to
show an app's subcommands, but you can write your own completion methods for
the App or its subcommands.
package main
import (
"fmt"
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
tasks := []string{"cook", "clean", "laundry", "eat", "sleep", "code"}
app := &cli.App{
EnableBashCompletion: true,
Commands: []*cli.Command{
{
Name: "complete",
Aliases: []string{"c"},
Usage: "complete a task on the list",
Action: func(c *cli.Context) error {
fmt.Println("completed task: ", c.Args().First())
return nil
},
BashComplete: func(c *cli.Context) {
// This will complete if no args are passed
if c.NArg() > 0 {
return
}
for _, t := range tasks {
fmt.Println(t)
}
},
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Enabling
Source the autocomplete/bash_autocomplete file in your .bashrc file while setting the PROG variable to the name of your program:
PROG=myprogram source /.../cli/autocomplete/bash_autocomplete
Distribution
Copy autocomplete/bash_autocomplete into /etc/bash_completion.d/ and rename
it to the name of the program you wish to add autocomplete support for (or
automatically install it there if you are distributing a package). Don't forget
to source the file to make it active in the current shell.
sudo cp src/bash_autocomplete /etc/bash_completion.d/<myprogram>
source /etc/bash_completion.d/<myprogram>
Alternatively, you can just document that users should source the generic
autocomplete/bash_autocomplete in their bash configuration with $PROG set
to the name of their program (as above).
Customization
The default shell completion flag (--generate-completion) is defined as
cli.GenerateCompletionFlag, and may be redefined if desired, e.g.:
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
cli.GenerateCompletionFlag = &cli.BoolFlag{
Name: "compgen",
Hidden: true,
}
app := &cli.App{
EnableShellCompletion: true,
Commands: []*cli.Command{
{
Name: "wat",
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
Generated Help Text
The default help flag (-h/--help) is defined as cli.HelpFlag and is checked
by the cli internals in order to print generated help text for the app, command,
or subcommand, and break execution.
Customization
All of the help text generation may be customized, and at multiple levels. The
templates are exposed as variables AppHelpTemplate, CommandHelpTemplate, and
SubcommandHelpTemplate which may be reassigned or augmented, and full override
is possible by assigning a compatible func to the cli.HelpPrinter variable,
e.g.:
package main
import (
"fmt"
"log"
"io"
"os"
"github.com/urfave/cli/v2"
)
func main() {
// EXAMPLE: Append to an existing template
cli.AppHelpTemplate = fmt.Sprintf(`%s
WEBSITE: http://awesometown.example.com
SUPPORT: support@awesometown.example.com
`, cli.AppHelpTemplate)
// EXAMPLE: Override a template
cli.AppHelpTemplate = `NAME:
{{.Name}} - {{.Usage}}
USAGE:
{{.HelpName}} {{if .VisibleFlags}}[global options]{{end}}{{if .Commands}} command [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}
{{if len .Authors}}
AUTHOR:
{{range .Authors}}{{ . }}{{end}}
{{end}}{{if .Commands}}
COMMANDS:
{{range .Commands}}{{if not .HideHelp}} {{join .Names ", "}}{{ "\t"}}{{.Usage}}{{ "\n" }}{{end}}{{end}}{{end}}{{if .VisibleFlags}}
GLOBAL OPTIONS:
{{range .VisibleFlags}}{{.}}
{{end}}{{end}}{{if .Copyright }}
COPYRIGHT:
{{.Copyright}}
{{end}}{{if .Version}}
VERSION:
{{.Version}}
{{end}}
`
// EXAMPLE: Replace the `HelpPrinter` func
cli.HelpPrinter = func(w io.Writer, templ string, data interface{}) {
fmt.Println("Ha HA. I pwnd the help!!1")
}
(&cli.App{}).Run(os.Args)
}
The default flag may be customized to something other than -h/--help by
setting cli.HelpFlag, e.g.:
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
cli.HelpFlag = &cli.BoolFlag{
Name: "haaaaalp", Aliases: []string{"halp"},
Usage: "HALP",
EnvVars: []string{"SHOW_HALP", "HALPPLZ"},
}
(&cli.App{}).Run(os.Args)
}
Version Flag
The default version flag (-v/--version) is defined as cli.VersionFlag, which
is checked by the cli internals in order to print the App.Version via
cli.VersionPrinter and break execution.
Customization
The default flag may be customized to something other than -v/--version by
setting cli.VersionFlag, e.g.:
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
cli.VersionFlag = &cli.BoolFlag{
Name: "print-version", Aliases: []string{"V"},
Usage: "print only the version",
}
app := &cli.App{
Name: "partay",
Version: "v19.99.0",
}
app.Run(os.Args)
}
Alternatively, the version printer at cli.VersionPrinter may be overridden, e.g.:
package main
import (
"fmt"
"log"
"os"
"github.com/urfave/cli/v2"
)
var (
Revision = "fafafaf"
)
func main() {
cli.VersionPrinter = func(c *cli.Context) {
fmt.Printf("version=%s revision=%s\n", c.App.Version, Revision)
}
app := &cli.App{
Name: "partay",
Version: "v19.99.0",
}
app.Run(os.Args)
}
Full API Example
Notice: This is a contrived (functioning) example meant strictly for API demonstration purposes. Use of one's imagination is encouraged.
package main
import (
"errors"
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"time"
"github.com/urfave/cli/v2"
)
func init() {
cli.AppHelpTemplate += "\nCUSTOMIZED: you bet ur muffins\n"
cli.CommandHelpTemplate += "\nYMMV\n"
cli.SubcommandHelpTemplate += "\nor something\n"
cli.HelpFlag = &cli.BoolFlag{Name: "halp"}
cli.GenerateCompletionFlag = &cli.BoolFlag{Name: "compgen", Hidden: true}
cli.VersionFlag = &cli.BoolFlag{Name: "print-version", Aliases: []string{"V"}}
cli.HelpPrinter = func(w io.Writer, templ string, data interface{}) {
fmt.Fprintf(w, "best of luck to you\n")
}
cli.VersionPrinter = func(c *cli.Context) {
fmt.Fprintf(c.App.Writer, "version=%s\n", c.App.Version)
}
cli.OsExiter = func(c int) {
fmt.Fprintf(cli.ErrWriter, "refusing to exit %d\n", c)
}
cli.ErrWriter = ioutil.Discard
cli.FlagStringer = func(fl cli.Flag) string {
return fmt.Sprintf("\t\t%s", fl.Names()[0])
}
}
type hexWriter struct{}
func (w *hexWriter) Write(p []byte) (int, error) {
for _, b := range p {
fmt.Printf("%x", b)
}
fmt.Printf("\n")
return len(p), nil
}
type genericType struct {
s string
}
func (g *genericType) Set(value string) error {
g.s = value
return nil
}
func (g *genericType) String() string {
return g.s
}
func main() {
app := &cli.App{
Name: "kənˈtrīv",
Version: "v19.99.0",
Compiled: time.Now(),
Authors: []*cli.Author{
&cli.Author{
Name: "Example Human",
Email: "human@example.com",
},
},
Copyright: "(c) 1999 Serious Enterprise",
HelpName: "contrive",
Usage: "demonstrate available API",
UsageText: "contrive - demonstrating the available API",
ArgsUsage: "[args and such]",
Commands: []*cli.Command{
&cli.Command{
Name: "doo",
Aliases: []string{"do"},
Category: "motion",
Usage: "do the doo",
UsageText: "doo - does the dooing",
Description: "no really, there is a lot of dooing to be done",
ArgsUsage: "[arrgh]",
Flags: []cli.Flag{
&cli.BoolFlag{Name: "forever", Aliases: []string{"forevvarr"}},
},
Subcommands: []*cli.Command{
&cli.Command{
Name: "wop",
Action: wopAction,
},
},
SkipFlagParsing: false,
HideHelp: false,
Hidden: false,
HelpName: "doo!",
ShellComplete: func(c *cli.Context) {
fmt.Fprintf(c.App.Writer, "--better\n")
},
Before: func(c *cli.Context) error {
fmt.Fprintf(c.App.Writer, "brace for impact\n")
return nil
},
After: func(c *cli.Context) error {
fmt.Fprintf(c.App.Writer, "did we lose anyone?\n")
return nil
},
Action: func(c *cli.Context) error {
c.Command.FullName()
c.Command.HasName("wop")
c.Command.Names()
c.Command.VisibleFlags()
fmt.Fprintf(c.App.Writer, "dodododododoodododddooooododododooo\n")
if c.Bool("forever") {
c.Command.Run(c)
}
return nil
},
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
fmt.Fprintf(c.App.Writer, "for shame\n")
return err
},
},
},
Flags: []cli.Flag{
&cli.BoolFlag{Name: "fancy"},
&cli.BoolFlag{Value: true, Name: "fancier"},
&cli.DurationFlag{Name: "howlong", Aliases: []string{"H"}, Value: time.Second * 3},
&cli.Float64Flag{Name: "howmuch"},
&cli.GenericFlag{Name: "wat", Value: &genericType{}},
&cli.Int64Flag{Name: "longdistance"},
&cli.Int64SliceFlag{Name: "intervals"},
&cli.IntFlag{Name: "distance"},
&cli.IntSliceFlag{Name: "times"},
&cli.StringFlag{Name: "dance-move", Aliases: []string{"d"}},
&cli.StringSliceFlag{Name: "names", Aliases: []string{"N"}},
&cli.UintFlag{Name: "age"},
&cli.Uint64Flag{Name: "bigage"},
},
EnableShellCompletion: true,
HideHelp: false,
HideVersion: false,
ShellComplete: func(c *cli.Context) {
fmt.Fprintf(c.App.Writer, "lipstick\nkiss\nme\nlipstick\nringo\n")
},
Before: func(c *cli.Context) error {
fmt.Fprintf(c.App.Writer, "HEEEERE GOES\n")
return nil
},
After: func(c *cli.Context) error {
fmt.Fprintf(c.App.Writer, "Phew!\n")
return nil
},
CommandNotFound: func(c *cli.Context, command string) {
fmt.Fprintf(c.App.Writer, "Thar be no %q here.\n", command)
},
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
if isSubcommand {
return err
}
fmt.Fprintf(c.App.Writer, "WRONG: %#v\n", err)
return nil
},
Action: func(c *cli.Context) error {
cli.DefaultAppComplete(c)
cli.HandleExitCoder(errors.New("not an exit coder, though"))
cli.ShowAppHelp(c)
cli.ShowCommandCompletions(c, "nope")
cli.ShowCommandHelp(c, "also-nope")
cli.ShowCompletions(c)
cli.ShowSubcommandHelp(c)
cli.ShowVersion(c)
categories := c.App.Categories
categories.AddCommand("sounds", &cli.Command{
Name: "bloop",
})
for _, category := range c.App.Categories.Categories() {
fmt.Fprintf(c.App.Writer, "%s\n", category.Name)
fmt.Fprintf(c.App.Writer, "%#v\n", category.VisibleCommands())
fmt.Fprintf(c.App.Writer, "%#v\n", category.VisibleCommands())
}
fmt.Printf("%#v\n", c.App.Command("doo"))
if c.Bool("infinite") {
c.App.Run([]string{"app", "doo", "wop"})
}
if c.Bool("forevar") {
c.App.RunAsSubcommand(c)
}
c.App.Setup()
fmt.Printf("%#v\n", c.App.VisibleCategories())
fmt.Printf("%#v\n", c.App.VisibleCommands())
fmt.Printf("%#v\n", c.App.VisibleFlags())
fmt.Printf("%#v\n", c.Args().First())
if c.Args().Len() > 0 {
fmt.Printf("%#v\n", c.Args().Get(1))
}
fmt.Printf("%#v\n", c.Args().Present())
fmt.Printf("%#v\n", c.Args().Tail())
set := flag.NewFlagSet("contrive", 0)
nc := cli.NewContext(c.App, set, c)
fmt.Printf("%#v\n", nc.Args())
fmt.Printf("%#v\n", nc.Bool("nope"))
fmt.Printf("%#v\n", !nc.Bool("nerp"))
fmt.Printf("%#v\n", nc.Duration("howlong"))
fmt.Printf("%#v\n", nc.Float64("hay"))
fmt.Printf("%#v\n", nc.Generic("bloop"))
fmt.Printf("%#v\n", nc.Int64("bonk"))
fmt.Printf("%#v\n", nc.Int64Slice("burnks"))
fmt.Printf("%#v\n", nc.Int("bips"))
fmt.Printf("%#v\n", nc.IntSlice("blups"))
fmt.Printf("%#v\n", nc.String("snurt"))
fmt.Printf("%#v\n", nc.StringSlice("snurkles"))
fmt.Printf("%#v\n", nc.Uint("flub"))
fmt.Printf("%#v\n", nc.Uint64("florb"))
fmt.Printf("%#v\n", nc.FlagNames())
fmt.Printf("%#v\n", nc.IsSet("wat"))
fmt.Printf("%#v\n", nc.Set("wat", "nope"))
fmt.Printf("%#v\n", nc.NArg())
fmt.Printf("%#v\n", nc.NumFlags())
fmt.Printf("%#v\n", nc.Lineage()[1])
nc.Set("wat", "also-nope")
ec := cli.Exit("ohwell", 86)
fmt.Fprintf(c.App.Writer, "%d", ec.ExitCode())
fmt.Printf("made it!\n")
return ec
},
Metadata: map[string]interface{}{
"layers": "many",
"explicable": false,
"whatever-values": 19.99,
},
}
if os.Getenv("HEXY") != "" {
app.Writer = &hexWriter{}
app.ErrWriter = &hexWriter{}
}
app.Run(os.Args)
}
func wopAction(c *cli.Context) error {
fmt.Fprintf(c.App.Writer, ":wave: over here, eh\n")
return nil
}