1
0
mirror of https://github.com/octoleo/hosts.git synced 2024-10-31 18:52:31 +00:00
Commit Graph

236 Commits

Author SHA1 Message Date
William Melody
db5cf5a97b Use more consistent spacing in usage statements. 2015-03-18 18:41:04 -07:00
William Melody
2ab32d006a Add license 2015-03-18 18:39:22 -07:00
William Melody
cf56224732 Add installation information to Readme. 2015-03-18 18:35:45 -07:00
William Melody
b5a2b28884 Remove redundant command usage entry in help 2015-03-18 18:28:38 -07:00
William Melody
37e9618359 Clarify help command usage in Readme. 2015-03-18 18:23:59 -07:00
William Melody
5844aa19a3 Use 'search string' consistently instead of mixing with 'search term' 2015-03-18 18:22:37 -07:00
William Melody
4d8c9a3385 Prompt user in remove
In order to avoid mistakes, prompt the user when removing records. Allow
skipping of the prompt using the --force option.
2015-03-18 18:20:24 -07:00
William Melody
00e94c8042 Verify write permissions before running write commands
When the user doesn't have write permissions, display a helpful error
message.
2015-03-18 18:02:09 -07:00
William Melody
a330d17862 Add $HOSTS_PATH variable
This variable makes it possible to configure the hosts path to something
other than /etc/hosts.
2015-03-18 17:47:20 -07:00
William Melody
bc36182773 Print disabled matches in show 2015-03-18 17:41:04 -07:00
William Melody
522d189f2e Update help with latest usage information. 2015-03-18 17:25:34 -07:00
William Melody
10704e2bd7 Use $DEFAULT_COMMAND pattern from bash-boilerplate
This is more verbose, but consistent with bash-boilerplate's approach.
2015-03-18 17:23:15 -07:00
William Melody
8889e26255 Run the list command by default when no command is provided 2015-03-18 17:13:25 -07:00
William Melody
e9dec32c90 Display disabled records in list when present
When disabled records are present, include them in a new section in the
default output of `list`. If no disabled records are present, don't
include the section.
2015-03-18 17:10:21 -07:00
William Melody
7d8a94d4ca Add 'enabled' and 'disabled' options to list
These return records that have the status specified in the option.
2015-03-18 17:05:33 -07:00
William Melody
9de0edda07 Add disable and enable commands
These commands make it possible to disable records without fully
removing them. To 'disable' a record, it simply is commented out with
the following pattern `#disabled: ` prepended to the line.
2015-03-18 16:53:03 -07:00
William Melody
124520efc4 Add show command and use that for list searches
Displaying a record pair for a hostname or IP address is likely a common
operation, and using the `show` name makes it clear what the primary
function of the command is. Since record pairs are very simple, the
easiest way to allow both hostname and ip address arguments is to use
grep, which also provides general search-like functionality. In order to
avoid doubling this functionality, use the `show` command in the `list`
command for search.
2015-03-18 16:07:49 -07:00
William Melody
cdf7793d7e Make list search terms match anywhere on the line
Making list more flexible enables searching for hostnames as well as
partial ip addresses.
2015-03-18 16:01:32 -07:00
William Melody
a8461f48fd Use alpha ordering for function definitions 2015-03-18 15:45:23 -07:00
William Melody
f7ed234951 Expand Readme slightly. 2015-03-16 20:13:19 -07:00
William Melody
a52020ed40 Add hosts file command to Readme. 2015-03-16 19:56:16 -07:00
William Melody
235be1f151 Expand per-command usage info.
Including descriptions of each command, since the functionality might
not always be immediately obvious.
2015-03-16 19:53:50 -07:00
William Melody
bafa955308 Add file command
This command simply runs `cat` on /etc/hosts
2015-03-16 19:48:16 -07:00
William Melody
2853d6fd33 Add per-command usage info to program help 2015-03-16 19:38:10 -07:00
William Melody
e867492064 In remove, delete the link in place rather than blanking first
When using the pattern of blanking the lines first and then deleting
the blank lines, the program ends up deleting potentially intentional
blank lines. In order to avoid this, use a simple delete rather than the
blanking + blank line deleting pattern.
2015-03-16 17:51:28 -07:00
William Melody
7607dfd262 Add edit command
`edit` open the hosts file in the editor specified in the $EDITOR
environment variable.
2015-03-16 17:39:50 -07:00
William Melody
fc60f3a0d7 Clarify usage information 2015-03-16 17:26:58 -07:00
William Melody
f714965f0f Add acknowledgements sections for script and Readme 2015-03-16 17:19:17 -07:00
William Melody
001fcfc959 Add initial Readme with basic information. 2015-03-16 17:08:59 -07:00
William Melody
42465bd461 Rewrite as command-based program using bash boilerplate
This program contains the same functionality as previous iterations,
with several changes:

- move to command-based structure using the bash boilerplate template,
- inlcude basic error handling,
- revise variable naming and options for clarity,
- prefer `printf` over `echo`,
- misc other revisions.
2015-03-16 16:58:35 -07:00
William Melody
b88046cd4b Rename script from host-manager to hosts 2015-03-12 20:35:24 -07:00
Dominique Feyer
ff7f431bd7 [TASK] Add list mode 2011-11-16 11:21:13 +01:00
Amos Wenger
d1edb3dd30 2011-11-15 14:19:15 -08:00
Amos Wenger
fd58acc7f7 2011-11-15 14:15:57 -08:00
Amos Wenger
b1aff730b9 2011-11-15 14:06:53 -08:00
Amos Wenger
608d654277 2011-11-15 14:06:00 -08:00