1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-11-24 21:57:35 +00:00
Commit Graph

298 Commits

Author SHA1 Message Date
William Melody
265a1c732e Add block and unblock functions.
`block` and `unblock` set the given <hostname> to the IPv4 and IPv6
loopback addresses.
2017-03-01 13:43:10 -08:00
William Melody
e8fa0d8ac8 Fix typos in README.md. 2017-03-01 12:49:36 -08:00
William Melody
b166d1b2ea Add missing list call in 'test/list.bats'. 2017-03-01 12:48:15 -08:00
William Melody
73ffcffb38 Add hosts search function.
`hosts search` wraps `hosts list`, providing a slightly more intuitive
interface.
2017-03-01 12:46:27 -08:00
William Melody
370e1f6688 Add autocomplete functions for bash and zsh. 2017-03-01 12:30:25 -08:00
William Melody
e9f3dc5431 Add "Tests" section to README.md. 2017-03-01 12:15:16 -08:00
William Melody
703d665a32 Use read with -r option.
ShellCheck SC2162: read without -r mangle backslashes

https://github.com/koalaman/shellcheck/wiki/SC2162
2017-03-01 12:05:59 -08:00
William Melody
4194b25459 Use HEREDOC rather than EOM to define heredocs. 2017-03-01 11:42:26 -08:00
William Melody
f4ebb9468a Rename "Readme.md" to "README.md". 2017-03-01 11:39:43 -08:00
William Melody
3ad43e7d95 Remove "Why" section from Readme.md. 2017-03-01 11:38:40 -08:00
William Melody
f7675f360e Bump version to 2.1.6. 2016-03-24 17:32:26 -07:00
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