1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-11-28 15:56:33 +00:00
Commit Graph

259 Commits

Author SHA1 Message Date
William Melody
05ba7bdc03 Quote argument to unset.
ShellCheck SC2184: Quote arguments to unset so they're not glob expanded.

https://github.com/koalaman/shellcheck/wiki/SC2184
2017-03-01 19:59:01 -08:00
William Melody
404ee19742 Add _verify_write_permissions() checks to block and unblock. 2017-03-01 19:32:49 -08:00
William Melody
3237818607 Expand documentation comment for _verify_write_permissions(). 2017-03-01 18:28:21 -08:00
William Melody
b7b186267d Bump version to 2.3.1. 2017-03-01 16:29:36 -08:00
William Melody
7919b171fe Fix typo in README.md. 2017-03-01 16:26:58 -08:00
William Melody
e0790f6a4c Bump version to 2.3.0. 2017-03-01 16:25:03 -08:00
William Melody
c3cee7c65d Simplify README.md links. 2017-03-01 16:24:10 -08:00
William Melody
99b175f134 Add --auto-sudo option and expand option documentation.
Using `sudo` within a script is generally considered poor practice, so
by default an error message is printed when the user attempts to perform
a write operation without sufficient permissions.

One way to deal avoid this error message is to alias `hosts` to `sudo
hosts`, but this then requires `sudo` for all operations and not just
write operations.

The new `--auto-sudo` option flag provides a way to automatically invoke
a write command with `sudo` when the user doesn't have write
permissions.

In order to provide cleaner documentation for this option, include more
option documentation in README.md.
2017-03-01 16:18:05 -08:00
William Melody
0925735153 Bump version to 2.2.0. 2017-03-01 14:29:04 -08:00
William Melody
0bb87f92fe Expand help documentation in README.md
Output formatted to markdown with:

    for __command in "$(hosts commands --raw)"
    do
      printf "### \`hosts %s\`\n" "${__command}"
      printf "\n"
      printf "\`\`\`text\n"
      hosts help "${__command}"
      printf "\`\`\`\n"
      printf "\n"
    done
2017-03-01 14:02:17 -08:00
William Melody
347189c059 Add search usage to primary help output.
Update README.md to more accurately reflect `help` output.
2017-03-01 13:45:19 -08:00
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