1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-11-21 12:25:14 +00:00
Commit Graph

357 Commits

Author SHA1 Message Date
William Melody
4be5105f67 Modify sed platform handling.
Use array for `sed -i` command so arguments are passed as expected. This
resolves an issue where a copy of the hosts file is created with quotes
appended to the filename.
2020-03-15 17:03:53 -07:00
William Melody
bfbe08a65b Update version to 3.1.2 2020-03-15 11:45:39 -07:00
William Melody
a2cddd9466 Update documentation in .shellcheckrc. 2020-03-15 11:40:13 -07:00
William Melody
4fae0d5526 Disable SC2206.
`IFS` and `noglob` are set, so we can ignore both SC2206 and SC2207.
2020-03-15 11:38:39 -07:00
William Melody
c680c02007 Update grammar in comment. 2020-03-15 11:36:47 -07:00
William Melody
a54793a9d0 Add .shellcheckrc and disable SC2207. 2020-03-15 11:32:09 -07:00
William Melody
fa9ba543f5 Set noglob to disable filename expansion (globbing). 2020-03-15 11:30:08 -07:00
William Melody
850f210a4f Assign command parameters as quoted array.
Satisfies Shellcheck SC2206
https://github.com/koalaman/shellcheck/wiki/SC2206
2020-03-14 19:03:50 -07:00
William Melody
fe48de86f1 Update version to 3.1.1 2019-11-21 19:28:51 -08:00
William Melody
2db235f68b Use portable [[:digit:]] in version tests.
`\d` is not portable so use `[[:digit]]`.
2019-11-21 19:26:49 -08:00
William Melody
e10d116510 Handle platform-specific sed -i requirements.
`sed -i` on macOS requires an extension, but on Linux that extension can
cause errors. Use a platform check to only include the extension on
macOS.

resolves gh-5
2019-11-21 19:17:45 -08:00
William Melody
060306f28b Use { ..; } instead of (..) to avoid subshell overhead.
ShellCheck SC2235: https://github.com/koalaman/shellcheck/wiki/SC2235
2019-11-04 17:01:16 -08:00
William Melody
6b72e51651 Add tests for duplicate entry guard.
Deplicate entries are avoided by a guard in the `add` subcommand. Add
tests to ensure that duplicate entries are not created.
2019-05-28 18:22:34 -07:00
William Melody
a475dc53aa
Add hosts file wikipedia link to README.md 2018-12-31 17:47:32 -08:00
William Melody
1ed6504bc2 Update version to 3.1.0 2018-08-14 11:31:02 -07:00
William Melody
14bfc65821 Fix 'enable' test names where needed. 2018-08-14 11:31:02 -07:00
William Melody
197ab087e6 Improve search tests.
Add tests for searching comments on disabled records and update test
names on search tests.
2018-08-14 11:31:02 -07:00
William Melody
789a0797c2 Improve search behavior.
Search comments in addition to IPs and hostnames.

Call grep twice, excluding commented lines first before searching.
2018-08-14 11:31:02 -07:00
William Melody
b44f3b8fe0
Update description in README.md 2018-08-14 11:24:51 -07:00
William Melody
500d0f9b7f
Update description in README.md 2018-08-14 10:48:55 -07:00
William Melody
af412412f2 Bump version to 3.0.1 2018-05-15 10:11:32 -07:00
{ɑβ}
899783e72d
Add link to AUR package in README.md 2018-05-15 10:06:02 -07:00
William Melody
5ee732006d Add comments about option parsing. 2018-05-15 08:37:24 -07:00
William Melody
647c4329c9 Update version to 3.0.0 2018-05-14 21:27:39 -07:00
William Melody
1738ba9ad3 Use double square brackets for option parsing while test. 2018-05-14 21:22:26 -07:00
William Melody
0c11a1939e Simplify help argument handling. 2018-05-14 21:19:36 -07:00
William Melody
dfcb37b3b6 Remove unused option normalization.
This program only really accepts one short argument, `-h`, so this
extra complexity isn't necessary.
2018-05-14 20:45:35 -07:00
William Melody
79a5aa95fc Update boilerplate to latest from bash-boilerplate.
Source: https://github.com/alphabetum/bash-boilerplate
2018-05-14 20:22:35 -07:00
William Melody
7f3f6a95ab Simplify regular expression variable handling.
- Remove '_target' prefixes.
- Declare and assign separately.
2018-05-14 20:12:19 -07:00
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