1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-11-16 01:57:14 +00:00
Commit Graph

59 Commits

Author SHA1 Message Date
William Melody
8f6a700909 Improve formatting in tests. 2020-05-17 11:33:57 -07:00
William Melody
1d948837d0 Use _exit_1 with non-help error messages. 2020-05-17 11:28:31 -07:00
William Melody
8f2553b5a3 Add $_ERROR_PREFIX to test_helper.bash. 2020-05-17 11:25:28 -07:00
William Melody
6e751065de Improve backups argument handling. 2020-05-17 10:54:03 -07:00
William Melody
88030b8a51 Return 1 from show when entry not found.
GH-9
2020-04-22 12:07:35 -07:00
William Melody
ace77c9926 Modify temp handling for better portability. 2020-04-12 19:04:39 -07:00
William Melody
56a27a040e Remove executable permissions from backups.bats. 2020-04-12 18:49:52 -07:00
William Melody
16c7484c17 Improve test failure messages. 2020-04-12 16:09:12 -07:00
William Melody
fb67d7b510 Just use diff in backups compare. 2020-04-08 21:25:01 -07:00
William Melody
5d9f876b13 Improve add formatting. 2020-04-08 17:27:11 -07:00
William Melody
902c996b3b Improve output formatting. 2020-04-08 16:43:07 -07:00
William Melody
5916a18908 Avoid relying on hosts being in $PATH.
gh-8
2020-03-30 17:41:51 -07:00
William Melody
4eed5251da Add backups command.
`backups` provides subcommands for managing backups of the hosts file.
2020-03-15 18:42:16 -07:00
William Melody
ada8cb6019 Handle multiple hostnames with block and unblock. 2020-03-15 17:10:29 -07: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
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
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
d8f86743f4 Test add with multi-word comment. 2018-05-14 18:53:06 -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
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
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
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
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
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