Commit Graph

59 Commits

Author SHA1 Message Date
Kevin van Zonneveld
2e68b71743
Move linting out to separate actions 2023-08-29 12:25:08 +02:00
Kevin van Zonneveld
28deb39d86
Fix tests 2023-08-29 12:24:49 +02:00
Kevin van Zonneveld
9a27140e7e
Deprecate Lanyon-based website in favor of a simple redirect to github 2023-08-29 12:01:10 +02:00
R. Fuehrer
1005ceeec8
Add feature edit/update comments (#132)
Remove obsolete lines of code
Update reference file
Update test scenario
2020-04-22 09:59:24 +02:00
R. Fuehrer
1238b67abe Add comment feature and feature checks (#130) 2020-01-07 09:32:57 +01:00
R. Fuehrer
971a83ea3a Enhanced ini file handling (#128)
* Add ini file creation if not exists
Add section creation if not exists
Add default section if section not given
Fix read key value only from given (or default) section

* Fix to support platform specific sed

* Fixed typo in comment

* Fix test scenario to reflect changes to the (introduced) default section

* Fix expectations for scenario test

* Fix style guide compatibility
2019-12-31 15:16:08 +01:00
Kevin van Zonneveld
03662dd404 Update main-repeated.stdio 2019-10-29 10:43:30 +01:00
Kevin van Zonneveld
685442bbcc Fix empty line crashing acceptance test 2019-10-29 09:56:40 +01:00
Kevin van Zonneveld
16b543114b Offer easier way to run a test scenario in debug mode 2019-10-29 09:52:34 +01:00
Kevin van Zonneveld
11cd18e179 Update colors in test fixtures 2019-10-29 08:42:15 +01:00
Kevin van Zonneveld
05f35415a6 Address ShellCheck error
```
In ./test/acceptance.sh line 101:
        -e "s@{root}/node_modules/\.bin/node@{node}@g" "${curFile}" \
                                  ^-- SC1117: Backslash is literal in "\.". Prefer explicit escaping: "\\.".
```
2019-10-29 08:42:04 +01:00
Kevin van Zonneveld
ec9087f0d2 Ignore any shell script in the website directory 2019-10-29 08:41:35 +01:00
Kevin van Zonneveld
5a9a68be2b Fix Typo 2019-10-29 08:41:22 +01:00
Lukas Stockner
95b9cb1469 Add support for repeatable arguments (#118)
* Add support for declaring arguments as repeatable

If the usage of the argument includes the phrase "Can be repeated.",
the corresponding arg_ variable will be an array containing one element
per instance of the argument.

* Add example and test for using repeated parameters

* Add example and test for using repeated flags
2019-09-20 11:40:06 +02:00
Manuel Streuhofer
ba0e7150cb close issue #108 (#109)
* added test for issue-108

* Closes #108

* fixed some easy shellcheck complaints

* trying to fix travis/debian-sid/shellcheck problem
2018-09-03 12:00:55 +02:00
Manuel Streuhofer
f57e37eb68 fix templater.sh and associated test
templater.sh now escapes the delimiter it uses for its sed magic within
the environment variable content.

the associated test uses a properly cleaned up temporary file instead of
explicitly rm-ing its own mess.
2018-01-23 22:02:57 +01:00
Manuel Streuhofer
860a7de899 shellcheck lead me astray 2018-01-21 23:19:16 +01:00
Manuel Streuhofer
236e3c7eca fix shellcheck errors
shellcheck 0.4.7 seems to have come up with new checks and now complains
about yet more possible issues. fixed them all as good as i could.
2018-01-21 23:02:03 +01:00
Germain Masse
84685a451b
Change egrep to grep -E in acceptance test script to comply with ShellCheck 2017-08-14 18:29:21 +02:00
Germain Masse
12ea4dd75f
Enable color in screen or tmux 2017-08-13 21:08:59 +02:00
Izaak Beekman
cb29b2f984
Restore @mstreuhofer's changes that I clobbered 2017-02-10 19:00:00 -05:00
Izaak Beekman
2d5506cb36
Perform syntax checking with all available bashes
Add tests to help catch bash4-isms and ensure syntax is checked with
 all bashes on PATH in a given system.
2017-02-10 18:58:36 -05:00
Izaak Beekman
0d1f488365
Fix shellchk and show usage for new magic var
Update acceptance tests
2017-02-10 18:58:35 -05:00
Manuel Streuhofer
d879ae1fe0 fixup example.sh like 2.3.0 main.sh
__i_am_main_script logic fixed for example.sh
added double-sourced test
2017-02-10 20:40:38 +01:00
Izaak Beekman
7cf9ea708d Issue 44 issue 21 issue 47 (#85)
* Fix shifting over `--`: don't throw errexit

 Fixes #21

* Add error trapping (including Ctrl-C) info to FAQ

 Closes #47

* Add backtracing to help localize errors

 - Fixes #44
 - Backtracing is turned on when the debugging `-d` flag is passed,
   otherwise backtracing function defined but signal trap not set.
 - Update main-help fixture due to moving trap

* Untabify main.sh

 Might be a controversial move, but I loath tabs...

* Add checks for tab chars and trailing whitespace

 - Update poor-man's style enforcement script to check for these
   violations
 - Better document style guidlines in README with small tweaks

* Add a magic variable to indicate if being source

 if `__i_am_main_script=1 #true` then `main.sh` called directly
 Fixes #45
2017-02-10 15:03:07 +01:00
Manuel Streuhofer
47be547cfa extend acceptance test to check for code style (#81)
* extend acceptance test to check for code style

* cleanup following own style guide
2016-12-21 19:30:28 +01:00
Manuel Streuhofer
785e7e9f8b Cleanup all *.sh following shellcheck advice (#80)
* Cleanup all *.sh following shellcheck advice

Closes #79

* do not shellcheck scripts out of our control
2016-12-16 08:18:03 +01:00
Manuel Streuhofer
ce755604da run shellcheck as part of the acceptance test (#77)
* install shellcheck from debian sid repository

* cleanup acceptance shell script

use a uniq temp directory and cleanup
make sure commands we use/need are installed

* shellcheck main.sh

* shellcheck example.sh

* shellcheck test/acceptance.sh

* brace all variables, used [[ instead of [
2016-12-15 12:57:42 +01:00
Manuel Streuhofer
9350e0574c added automatic usage validation for required args
If the description of an option contains the single word sentence
'Required.' it is understood as a required argument and automatic
validation will make sure that it is set or end the script by calling
help.

Alternatively, if the argument within the __usage string is {arg}
instead of [arg] it is understood as a required argument and automatic
validation will make sure that it is set or end the script by calling
help (even if 'Required.' is not in the description).

Closes #22
2016-12-09 00:54:52 +01:00
Manuel Streuhofer
1e69fd5e21 removed all usage of eval, proper usage of unset
replaced all `eval` with `printf -v` for security reasons.

the behaviour of unset without -v/-f is actually undefined so make the
intent clear.
2016-12-06 18:06:25 +01:00
Manuel Streuhofer
290c65d4b9 fix auto-color-off code
turn off colors if NO_COLOR is "true" or TERM is not "xterm*" or STDERR
is not connected to a terminal, but ignore TERM and STDERR if NO_COLOR
is set to "false" explicitly.

Fixes #69
2016-12-03 18:52:10 +01:00
Manuel Streuhofer
539443b3ca Allow for multiline opt description in __usage. Fixes #7 2016-11-11 20:13:01 +01:00
Manuel Streuhofer
dfd799b4e5 b3bp sourced mode (#61)
If main.sh is being sourced instead of being executed it respects the
variables __usage and __helptext being defined beforehand. Its behaviour
will depend on the sourcing script. If __usage is defined but empty no
argument parsing is done. If __helptext is defined but empty no helptext
will be shown.

Logging support still exists as it did before. The environment variables
LOG_LEVEL and NO_COLOR are supported just as they were before.
2016-11-09 10:03:00 +01:00
Manuel Streuhofer
d2195eee3c mention the used license in each script header (#60)
turns out that the README.md explains that "... licensed under MIT ...
the LICENSE does not have to be bundled as long as ..." but the scripts
themselfs don't mention any license.

fixed that by adding a one line mention of the used license and the two
lines explaining that the header comments have to stay intact.
2016-11-08 21:15:46 +01:00
Manuel Streuhofer
f82bbe59b0 better logging. support for multiple lines. (#57)
* better logging: support for multiple lines

* renamed logging function from _fmt to __b3bp_log

* adding example to show how multiline logging works

the main idea is to be able to log e.g. the output of a command and
b3bp taking care of splitting and prefixing every line.

* simplified code, removed hacky space-at-EOL
2016-11-08 13:03:26 +01:00
Kevin van Zonneveld
35b51072b3 No more os detection (#41) 2016-06-24 13:12:41 +02:00
Kevin van Zonneveld
e56e21dc37 b3bp dogfooding for acceptance.sh 2016-06-21 13:51:51 +02:00
Kevin van Zonneveld
efefd5cf2b Update fixtures after introducing helptext 2016-06-21 13:08:43 +02:00
Kevin van Zonneveld
51213e8786 Fix test again, now that we got confirmed failures out of Travis OSX #10 2016-02-23 10:21:43 +01:00
Kevin van Zonneveld
6dc7e1f92a Don't use a subshell to handle diff failures. Refs #10 2016-02-23 10:16:58 +01:00
Kevin van Zonneveld
c111725665 Purposely fail. Does this pass OSX Travis build? 2016-02-23 10:10:39 +01:00
Kevin van Zonneveld
abb480c394 Use accptst prefix so we can re-use this thing elsewhere 2016-02-23 10:06:45 +01:00
Izaak Beekman
1143670cae
Update expected test output 2016-02-22 10:11:12 -05:00
Kevin van Zonneveld
1271bf807d Add tests for megamount and follow Library export best practices 2016-02-17 13:38:55 +01:00
Kevin van Zonneveld
7fbf9ea8e5 Add tests for templater and follow Library export best practices 2016-02-17 13:19:03 +01:00
Kevin van Zonneveld
707583a93c Fix paths 2016-02-17 13:01:18 +01:00
Kevin van Zonneveld
e538a2be34 Rename inival->ini_val 2016-02-17 12:58:28 +01:00
Kevin van Zonneveld
c3f5bcf8c9 Add tests for parse_url and follow Library export best practices 2016-02-17 12:58:18 +01:00
Kevin van Zonneveld
180282d97d Add tests for ini_val and follow Library export best practices 2016-02-17 12:48:57 +01:00
Kevin van Zonneveld
d365e8dcea Allow disabling colors via NO_COLOR environment variable 2016-02-16 22:19:40 +01:00