75 Commits

Author SHA1 Message Date
2a9cdd82fa Remove RPM spec stuff from README and Makefile, simplify install instructions
Some checks failed
CI with JUnit Report / build-and-test (push) Has been cancelled
2026-01-19 17:49:16 -05:00
7342a05822 Make cmdarg_dump print out cmdarg_argv as well
Some checks failed
CI with JUnit Report / build-and-test (push) Has been cancelled
2026-01-19 15:55:44 -05:00
cd9594264a Merge remote-tracking branch 'zaneduffield/master'
Some checks failed
CI with JUnit Report / build-and-test (push) Has been cancelled
2026-01-18 12:26:25 -05:00
b5bc40cf67 Add shellcheck action to CI 2026-01-18 12:17:00 -05:00
0c8137e474 Fix dependency installation for github CI 2026-01-18 12:08:36 -05:00
f5acdfe6b5 Fail build on failed tests 2026-01-18 11:50:17 -05:00
725ed205c4 Adding junit testing and reporting 2026-01-18 11:42:57 -05:00
Zane Duffield
94f11c6f01 Simply copyright and author header components when empty 2026-01-14 12:27:32 +11:00
Zane Duffield
66563ad58a Add .shellcheckrc to silence lints 2026-01-14 11:54:19 +11:00
Zane Duffield
9772c9378d Fix misc shellcheck issues
* make clear that array expansion was not desired in one case
* change `$@` to `$*` in one case
* remove unnecessary `$` in arithmetic context
* fix quoting in complex traceback message
2026-01-14 11:54:19 +11:00
Zane Duffield
f649a18a75 Fix array expansion errors on unknown parameter names
When unexpected parameters are passed to cmdarg, the shell (bash 5.1.8)
spits out some error messages about bad array subscripts, for example

> cmdarg.sh: line 333: CMDARG_FLAGS: bad array subscript
> cmdarg.sh: line 334: CMDARG_FLAGS: bad array subscript
> cmdarg.sh: line 340: CMDARG: bad array subscript

This occurs because the array is being indexed by a null value, so to
prevent it we must guard all such uses with a check.
2026-01-14 11:54:19 +11:00
Zane Duffield
1e31ed1998 Quote array expansion when appending to cmdarg_argv
Without this change, excess arguments are split and glob-expanded when
appended to the cmdarg_argv array.
2026-01-14 11:54:19 +11:00
Zane Duffield
ad35f698ea Quote variables to avoid word splitting a glob matching
In all cases here, the contents of the variables are single words and do
not contain special glob characters, so it's mostly a change for
consistency and best practice.
2026-01-14 11:54:18 +11:00
Zane Duffield
8862ba1999 Convert tabs to spaces
The script used mixed indentation, meaning that it only made sense to
read when the tab width was set properly (to 8). Using consistent
indentation makes the script easier to read.
2026-01-14 11:13:40 +11:00
Andrew Kesterson
cdc010720f Merge pull request #21 from gundalow/patch-1
Improved validate_int
2016-09-05 14:37:51 -07:00
John Barker
9bc2991ff6 Improved validate_int
Use bash builtin's for validate_int example
2015-09-18 16:36:01 +01:00
977badef4b cmdarg_info had no test coverage, plz2fix 2014-08-12 07:56:19 -07:00
2f65202f34 Merge pull request #19 from johnae/master
cmdarg_info so it checks for anything NOT in flags
2014-08-12 07:55:54 -07:00
John Axel Eriksson
5c2fbc5110 cmdarg_info so it checks for anything NOT in flags
The cmdarg_info function should check whether the input is NOT in flags rather than the other way around. Otherwise it will fail every time when doing one is actually doing the right thing.
2014-08-12 14:48:08 +02:00
aede1cefbe Fixed some broken longopt and helpers related tests 2014-06-07 22:39:58 -07:00
77bf69ee69 Fixes #6 : Proper array bounds checking 2014-06-07 21:38:03 -07:00
c7c2e31b83 Close #9 : Ensured all local vars are declared local. Also removed builtin cmdarg_cfg['cfgfile'] loading as it was undocumented and even I forgot it was there. 2014-05-26 12:26:18 -07:00
7188ec557f Close #5 : Removed all calls to cut/grep 2014-05-26 12:19:00 -07:00
d3721faf10 Close #17 and Close #16
Introduces CMDARG_ERROR_BEHAVIOR. Adds some more tests. Introduces new
behavior for hash validators (see README). Fixes a few odds and ends.
2014-05-26 11:45:17 -07:00
5c926c54e2 Update UPGRADING.md 2014-05-20 09:24:31 -07:00
83cfe31f77 Added UPGRADING.md for 2.0 breaking changes 2014-05-20 09:03:44 -07:00
b7f85914e7 Close #13 : cmdarg_helpers[] introduced, README documentation updated 2014-05-20 08:49:46 -07:00
83c4552371 Made validators less silly (require strict functions) and updated docs 2014-05-19 17:15:54 -07:00
15ed92d390 Close #11 : This does, indeed, fix the big janky naming bug 2014-05-19 16:30:07 -07:00
a5b412f29b Clarify #14 : boolean processing places optarg into cmdarg_argv, we can debate that later 2014-05-12 08:06:10 -07:00
1ba6694330 Close #7 : use BASH_VERSINFO instead of janky version check 2014-05-12 07:19:45 -07:00
f72240fd19 Closes #12 : all calls to cmdarg_usage go to stderr 2014-05-12 07:15:59 -07:00
1efe7758cb Update README.md 2014-05-03 13:17:05 -07:00
965d6ed8ea Update README.md 2014-05-03 13:16:39 -07:00
0b0ac881bd Update README.md 2014-05-03 11:02:32 -07:00
3db0f39891 Update README.md 2014-05-03 10:53:38 -07:00
e22fc91242 Update Makefile 2014-04-21 21:39:19 -07:00
e1c49e0044 Update Makefile 2014-04-21 21:35:20 -07:00
c04f8af3af Update Makefile 2014-04-21 21:32:43 -07:00
b11c675564 Update Makefile 2014-04-21 21:28:50 -07:00
1dacc31929 Update Makefile 2014-04-21 21:26:49 -07:00
fbbde4005a Update Makefile 2014-04-21 21:26:01 -07:00
59eb3b9f81 Update Makefile 2014-04-21 21:23:12 -07:00
660be47473 Update README.md 2014-04-21 21:11:12 -07:00
07f2cb09bb Update README.md 2014-04-21 20:33:29 -07:00
071f170b67 Fixes #4 : Make cmdarg understand '--option=value|-o=value' syntax. 2014-04-19 21:41:57 -07:00
77e92fbfb5 Fixes #4 : Make cmdarg understand '--option=value|-o=value' syntax. 2014-04-19 21:39:23 -07:00
950d630c4d Update README.md 2014-04-09 13:12:01 -07:00
3b7f95e33e #3 : Fix handling of optional vs required arguments 2014-01-30 16:34:49 -05:00
d7e111c6d6 Fixes #1 : Long arguments now display in cmdarg_usage() 2014-01-27 11:22:14 -05:00