William Melody
149a51662e
Handle blank arguments string when assigning to $_RAW_OPTIONS
.
...
When `$*` is specified with quotes and braces as `"${*}"`, a blank
argument array results in an error in older versions of bash. Remove
the braces to avoid this error.
2016-03-24 17:30:30 -07:00
William Melody
187222614a
Use braces in all variable references.
...
Braces are only required in certain cases, but the cognitive overhead in
keeping track of which cases require braces can be reduced by simply
always using them.
Example: `${NAME}`
Retain more widely-used braces `$NAME` convention in documentation.
2016-02-23 18:14:21 -08:00
William Melody
9782f78f22
Bump version to 2.1.5.
2016-01-26 20:42:26 -08:00
William Melody
f7c7aef173
Update help/usage formatting.
2016-01-26 20:25:16 -08:00
William Melody
f8564cfb2f
Test argument with no match in remove.bats.
2016-01-26 20:17:55 -08:00
William Melody
eb57a685c4
Expand list.bats.
2016-01-26 20:15:10 -08:00
William Melody
4330a73c3c
Add remove.bats.
2016-01-26 19:35:04 -08:00
William Melody
73134c6b7b
Remove unnecessary setup operations in enable.bats and disable.bats.
2016-01-26 19:17:36 -08:00
William Melody
ee2a851bc9
Add show.bats.
2016-01-26 19:16:11 -08:00
William Melody
0bd1c32cd1
Use version
command for tests that expect it in version.bats.
2016-01-26 19:08:04 -08:00
William Melody
4265bfe1f9
Add help tests to version.bats.
2016-01-26 19:07:05 -08:00
William Melody
abfd442c3d
Add help tests to file.bats.
2016-01-26 19:05:47 -08:00
William Melody
f30981ec80
Add help tests to enabled.bats.
2016-01-26 19:05:10 -08:00
William Melody
481e593666
Add help tests to enable.bats.
2016-01-26 19:04:18 -08:00
William Melody
c5fe3aedb2
Add help tests to disabled.bats.
2016-01-26 19:03:08 -08:00
William Melody
631c295ad1
Add help tests to disable.bats.
2016-01-26 19:02:07 -08:00
William Melody
d88d819a19
Add help tests to add.bats.
2016-01-26 19:01:02 -08:00
William Melody
07108dc706
Add help tests to list.bats.
2016-01-26 19:00:02 -08:00
William Melody
09c375633f
Add list.bats.
2016-01-26 18:58:32 -08:00
William Melody
5847cec598
Add enabled.bats.
2016-01-26 18:53:41 -08:00
William Melody
11fb3872e3
Add enable.bats.
2016-01-26 18:50:43 -08:00
William Melody
2f0a45bb5a
Add disabled.bats.
2016-01-26 18:31:17 -08:00
William Melody
41a63ddf49
Add disable.bats.
2016-01-26 18:27:18 -08:00
William Melody
7b9e34ba53
Add add.bats.
2016-01-26 18:08:18 -08:00
William Melody
b4c7370c10
Test number of $lines
in hosts.bats test.
2016-01-26 17:49:05 -08:00
William Melody
7c961e1318
Add version.bats.
2016-01-25 19:27:49 -08:00
William Melody
6783e94f16
Fix typo in test_helper.bash comment.
2016-01-25 17:25:10 -08:00
William Melody
810e407c9e
Fix copy/paste typos in help.bats.
2016-01-25 17:21:20 -08:00
William Melody
8faa7a0ab6
Add _compare()
function to test_helper.bash.
2016-01-25 17:20:10 -08:00
William Melody
8e267fafd7
Edit hosts.bats test names to conform to project conventions.
2016-01-24 22:57:56 -08:00
William Melody
4e7cd2279e
Add information about Bats to top of test_helper.bash.
2016-01-24 22:38:55 -08:00
William Melody
0c95e842ad
Use /tmp directory for temp file generated with mktemp
.
...
Moving to `mktemp` with files in /tmp makes it possible to remove the
local test/tmp directory.
2016-01-24 22:32:37 -08:00
William Melody
835d944bf9
Add help.bats with tests for the help
subcommand.
2016-01-24 21:49:55 -08:00
William Melody
4cf3bc0a63
Test file
output against $HOSTS_PATH
.
2016-01-24 21:27:24 -08:00
William Melody
ae9c4f0f4b
Add tests for file
.
2016-01-24 21:21:40 -08:00
William Melody
30ed049441
Add initial test structure with test 'hosts' file.
2016-01-24 21:14:32 -08:00
William Melody
eeab6e8ba1
Alphabetize subcommands in Usage.
...
It's easier to find a subcommand in an alphabetical list.
2016-01-15 16:52:41 -08:00
William Melody
80a8e48c10
Use if..then
in show
to avoid non-zero exits.
...
The `[[ ... ]] && ...` conditional style results in non-zero exits when
the test is false. Moving this to a traditional `if..then` style avoids
this behavior while also being more explicit about the objective of the
code. `|| return 0` or `|| exit 0` could have been added as an
alternative way to avoid the non-zero exit behavior, but is not used in
this case because the traditional `if..then` style is more common.
2015-11-29 18:09:35 -08:00
William Melody
4d1adbdf52
Bump version to 2.1.4.
2015-11-25 18:03:19 -08:00
William Melody
b1b644b97d
Simplify description in Readme.md.
2015-11-24 16:16:09 -08:00
William Melody
8872349c16
Use fenced code blocks in Readme.md.
2015-11-24 16:15:45 -08:00
William Melody
21069fb68d
Add quotes around strings in list
command argument tests.
...
Quoting these strings more clearly communicates that these are not
variable or function names, and that the string itself is what is
being tested for.
2015-11-23 11:16:03 -08:00
William Melody
59e404f865
Add newlines around prompt section of remove
.
...
The convention used in this project is to include newlines around
longer, grouped conditionals in order to provide better visual
separation.
2015-11-23 11:07:45 -08:00
William Melody
279573d2d0
Update regular expression comments in remove
.
...
The regular expressions to which these comments apply were moved
around a few times without the comments being updated for these
changes.
2015-11-23 11:01:43 -08:00
William Melody
e8e161f1e8
Bump version to 2.1.3.
2015-11-23 10:45:23 -08:00
William Melody
09d6d83093
Fix --force
behavior in remove
.
...
The `--force` option is passed to the function in `$_COMMAND_ARGV`,
which means that assigning arguments from positions in this array leads
to unexpected behavior depending on where in the argument list `--force`
is included. As a result, the `remove` function must parse the
arguments, removing the `--force` argument before assigning function
arguments to local variables.
resolves #2
2015-11-23 10:38:45 -08:00
William Melody
a869da8e4e
Clarify slicing example in $_COMMAND_PARAMETERS
comment.
...
The example assignment should have balanced quotes to avoid any copy /
paste errors or reader confusion. Remove the 'not' since it's clearer if
this is used as a parenthetical example of slicing.
2015-10-19 16:50:48 -07:00
William Melody
0b955f41fa
Bump version to 2.1.2.
2015-10-19 16:30:32 -07:00
William Melody
e9b78ee15f
Include debug statements in add()
to print positional arguments.
2015-10-19 16:29:06 -07:00
William Melody
b539cd6136
Use unset
rather than slicing for bash 3.2 compatibility.
...
Use `unset` to remove the first element of `$_COMMAND_PARAMETERS` rather
than slicing because under bash 3.2 the resulting slice is treated as a
quoted string and doesn't easily get coaxed back into an array.
2015-10-19 16:26:21 -07:00