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

228 Commits

Author SHA1 Message Date
William Melody
6da4b7475f Update coding style.
- Quote variables throughout.
- Use underscore prefixes to denote script-local variables and avoid
  identifier conflicts.
- Add spacing for better statement grouping.
2018-05-14 20:03:32 -07:00
William Melody
d8f86743f4 Test add with multi-word comment. 2018-05-14 18:53:06 -07:00
William Melody
661fa3b114 Use updated _join() implementation.
Source: https://github.com/alphabetum/bash-boilerplate
2018-05-14 18:46:52 -07:00
William Melody
dd25af8c99 Use updated _load_commands() implementation.
Source: https://github.com/alphabetum/bash-boilerplate
2018-05-14 18:42:21 -07:00
William Melody
2a5a18cf85 Bump version to 2.4.3
Fix misalignment between version numbers in package.json and
`$_VERSION`.
2018-05-09 10:36:18 -07:00
William Melody
cfeb032707 Bump version to 2.4.2 2018-05-06 14:47:46 -07:00
William Melody
a5bb823bac Improve setup / teardown of tmp test file.
Use a separate variable to identify tmp file during setup and teardown
operations.
2018-05-06 14:44:16 -07:00
William Melody
746780fbbe Use explicit escaping for backslashes in all contexts.
ShellCheck SC1117
https://github.com/koalaman/shellcheck/wiki/SC1117
2018-04-15 15:01:34 -07:00
William Melody
80edd464b6 Use explicit escaping for "\\n" newlines.
Backslash is literal, so explicitly escape it rather than rely on
fallback behavior.

ShellCheck SC1117
https://github.com/koalaman/shellcheck/wiki/SC1117
2018-04-15 14:55:26 -07:00
{ɑβ}
b242081ef1
Add blocklists to README.md 2017-12-31 09:02:09 -08:00
William Melody
17a4eb1890 Use heading 3 for all command names in README.md. 2017-04-06 10:48:04 -07:00
William Melody
d02f46a99e Bump version to 2.4.1. 2017-03-01 20:55:06 -08:00
William Melody
d700037f18 Simplify header comment. 2017-03-01 20:54:08 -08:00
William Melody
32c5be4dcc Revert "Prefix _debug strings with '•' to avoid highlighting bugs."
This reverts commit 921afd7155.

The reverted commit did not succeed in fixing highlighting bugs.
2017-03-01 20:51:36 -08:00
William Melody
921afd7155 Prefix _debug strings with '•' to avoid highlighting bugs.
GitHub's syntax highlighting doesn't work well when strings contain
function names with parentheses, so add character to the beginning of
the string to see whether this makes it better.
2017-03-01 20:46:49 -08:00
William Melody
f5d0f827e0 Bump version to 2.4.0. 2017-03-01 20:24:12 -08:00
William Melody
d94af2c25b Update comments in "Globals" section. 2017-03-01 20:22:41 -08:00
William Melody
db7ac727f1 Rename $DEFAULT_COMMAND to $HOSTS_DEFAULT_COMMAND. 2017-03-01 20:21:06 -08:00
William Melody
6c0254895f Support full list operations in hosts with no subcommand. 2017-03-01 20:18:26 -08:00
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