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

193 Commits

Author SHA1 Message Date
William Melody
e8e161f1e8 Bump version to 2.1.3. 2015-11-23 10:45:23 -08:00
William Melody
09d6d83093 Fix --force behavior in remove.
The `--force` option is passed to the function in `$_COMMAND_ARGV`,
which means that assigning arguments from positions in this array leads
to unexpected behavior depending on where in the argument list `--force`
is included. As a result, the `remove` function must parse the
arguments, removing the `--force` argument before assigning function
arguments to local variables.

resolves #2
2015-11-23 10:38:45 -08:00
William Melody
a869da8e4e Clarify slicing example in $_COMMAND_PARAMETERS comment.
The example assignment should have balanced quotes to avoid any copy /
paste errors or reader confusion. Remove the 'not' since it's clearer if
this is used as a parenthetical example of slicing.
2015-10-19 16:50:48 -07:00
William Melody
0b955f41fa Bump version to 2.1.2. 2015-10-19 16:30:32 -07:00
William Melody
e9b78ee15f Include debug statements in add() to print positional arguments. 2015-10-19 16:29:06 -07:00
William Melody
b539cd6136 Use unset rather than slicing for bash 3.2 compatibility.
Use `unset` to remove the first element of `$_COMMAND_PARAMETERS` rather
than slicing because under bash 3.2 the resulting slice is treated as a
quoted string and doesn't easily get coaxed back into an array.
2015-10-19 16:26:21 -07:00
William Melody
6733260385 Bump version to 2.1.1 2015-09-15 11:33:39 -07:00
William Melody
ab8934ae80 Default to 'N' in remove confirmation.
Rather than require a response, use 'N' as the default since this is a
destructive action.
2015-09-15 11:30:30 -07:00
William Melody
871e8fc131 Bump version to 2.1.0 2015-09-12 16:21:04 -07:00
William Melody
db4df46caa Rename search_term to search_string in enable and disable.
`search_string` is slightly more descriptive, and it's the name that's
used in `remove`.
2015-09-12 16:18:53 -07:00
William Melody
1242d0b4bc Replace 'domain' with 'hostname' in regular expression variable names.
'hostname' is more accurate and consistent for this context.
2015-09-12 16:14:36 -07:00
William Melody
95fd43668a Assign remove regular expressions to variables.
Since the regular expressions are essentially repeated, with the only
difference being the capturing groups that have no impact on the delete
operations, assign them to a set of descriptive variables. This makes
things more organized and additionally provides some explanation for
what each regular expression is matching against.
2015-09-12 16:12:56 -07:00
William Melody
ab9a08d954 Enhance remove to accept an IP and hostname pair.
This provides a mechanism for removing exact IP and hostname pairs.
The existing search string functionality should continue to function as
it did previously.
2015-09-12 15:41:28 -07:00
William Melody
1d1fa7ce9f Match IP at start of line in disable
The `disable` regular expressions avoid matching against commented lines
by excluding '#' characters at the beginning of the line. However, the
IP portion of the record is at the beginning of non-commented lines, so
in order to match these IPs the `target_regex_ip` needs to have the
search term checked against the beginning of the line. Therefore, the
`[^#]` at the beginning of `target_regex_ip` must be removed to make
`search_term` properly match these IPs.
2015-09-12 15:03:09 -07:00
William Melody
b8811d42ba Bump version to 2.0.0 2015-09-12 14:16:43 -07:00
William Melody
84d77b8aec Export space and tab regular expression variables.
These variables are used within regular expressions, but as the program
evolves they are not always in constant use. Exporting these variables
silences ShellCheck warnings and makes them available to subshells.
2015-09-12 14:13:00 -07:00
William Melody
a33b38b204 Make sed ops in enable/disable only match exact columns.
This is an application of the approach to `sed` calls that was included
in 94ca8bf

In order to make editing more precise, `sed` regular expressions only
match exact occurrences of the search string within each entry column.
2015-09-12 14:08:48 -07:00
William Melody
9cb7576bb5 Merge branch 'master' into exact-matches
* master:
  Exit with "Not found" message on failed search in `enable`/`disable`
  Bump version to 1.5.0
  Print confirmation feedback in `add` on success.
  Declare and assign separately to avoid masking return values.
  Add `brew tap` command to `brew install` in Readme.
2015-09-12 13:28:31 -07:00
William Melody
8465c2bdf8 Exit with "Not found" message on failed search in enable/disable
When the search string in `enable` or `disable` is not found, exit the
program and provide feedback rather than silently failing.
2015-09-12 13:19:17 -07:00
William Melody
62f200574d Bump version to 1.5.0 2015-09-11 19:51:02 -07:00
William Melody
590d75096f Print confirmation feedback in add on success. 2015-09-11 19:47:52 -07:00
William Melody
12d11c2dc3 Declare and assign separately to avoid masking return values.
ShellCheck SC2155
2015-09-11 19:43:56 -07:00
William Melody
5759ade2eb Add brew tap command to brew install in Readme. 2015-06-29 19:58:17 -07:00
William Melody
94ca8bfb57 Make sed operations in remove only match exact column matches.
In order to make editing more precise, sed regular expressions only
match exact occurrences of the search string within each entry column.

In order to properly handle tab and space separators in a portable
manner, a set of global variables are included that provide strings
of those characters.
2015-06-28 22:09:46 -07:00
William Melody
46dcff947c Bump version to 1.4.3 2015-06-28 22:08:29 -07:00
William Melody
41a84bd0ed Uppercase $_USE_DEBUG reference in _debug
This variable was uppercased in a09d0fc but this occurrence was missed.
2015-06-28 17:32:42 -07:00
William Melody
5a1ffa3498 Bump version 1.4.2
package.json was missed in c80287f
2015-06-27 20:51:45 -07:00
William Melody
c80287f2bf Bump version to 1.4.2 2015-06-27 20:49:06 -07:00
William Melody
fa920b0a97 Use local keyword more consistently. 2015-06-27 20:47:36 -07:00
William Melody
a09d0fc893 Update boilerplate to reflect latest updates from source. 2015-06-27 20:43:19 -07:00
William Melody
8b0fc0fcfe Quote command names passed as arguments to desc 2015-06-27 20:33:11 -07:00
William Melody
d2b92aec5a Prefer newlines instead of semicolons. 2015-06-27 20:31:26 -07:00
William Melody
66edbfd03c Update _debug and _die comments. 2015-06-27 20:21:58 -07:00
William Melody
3cfa2c8cf9 Use simpler $IFS setting. 2015-06-27 20:17:41 -07:00
William Melody
2693c62693 Bump version to 1.4.1 2015-06-25 17:19:23 -07:00
William Melody
02a87b0938 Add optional extension argument to sed -i calls
BSD sed requires the optional exention argument for the -i option, while
in GNU sed it's optional. Including a blank extension for portability.
2015-06-25 17:17:12 -07:00
William Melody
13d1428ee9 Add large ascii text of name to Readme 2015-05-20 20:31:05 -07:00
William Melody
d5b6456766 Bump version to 1.4.0 2015-05-20 16:49:46 -07:00
William Melody
db2b5ad074 Add expanded installtion instructions to Readme
Include command for manual and bpkg installation methods.
2015-05-20 16:48:08 -07:00
William Melody
371b644f6f Add package.json for bpkg 2015-05-20 16:47:32 -07:00
William Melody
87bce12994 Add basic Makefile
This simply installs the script to /usr/local/bin
2015-05-20 16:46:02 -07:00
William Melody
08d899fee5 Fix inert indentation typo. 2015-04-28 16:54:25 -07:00
William Melody
9a395fd017 Bump version to 1.3.0 2015-04-18 21:23:45 -07:00
William Melody
26ad499fee Spelling correction: formmatted_comment -> formatted_comment 2015-04-18 21:21:46 -07:00
William Melody
2c83de9dff Declare and assign separately to avoid masking return values.
ShellCheck SC2155

https://github.com/koalaman/shellcheck/wiki/SC2155
2015-04-18 21:17:46 -07:00
William Melody
cb9e20e554 Use capitalized form of $_ME variable.
The capitalized version of this variable makes it easier to override,
even though this is not technically part of the external API. There is
no known downside of using the capitalized version of the variable.
2015-04-18 21:06:26 -07:00
William Melody
e62bede843 Bump version to 1.2.0 2015-03-20 18:11:42 -07:00
William Melody
c2ca24b459 Verify that matching records have been found in remove before removing 2015-03-20 18:10:51 -07:00
William Melody
312f5909fa Add ability to add an option comment when adding a record
This addition requires a number of changes including:

- the addition of a new `_join` function
- reformatting of the `add` function to facilitate the longer lines
2015-03-20 18:06:00 -07:00
William Melody
023aa0503f Add enabled and disabled to command list in --help 2015-03-20 17:23:31 -07:00