CLI tool to manage hosts file
Hosts Manager is a utility to quickly and easily manage hosts in your hosts file., (*1)
git clone firstname.lastname@example.org:xFlatlinex/hosts.gitto clone the repo.
composer installto install dependencies.
At this point you should be able to run it like this
php bin/hosts., (*2)
There are two ways to install it. Using composer global or compile the phar and
move it to your corresponding
bin dir. Note that both methods need composer,
but the first one needs composer to be installed globally., (*3)
After you install it you should be able to run it directly:, (*4)
$ hosts add somehost
First, make sure you have ~/.composer/vendor/bin/ in your path.
Then run the following composer command:, (*5)
$ composer global require 'flatline/hosts=dev-master'
This way, you need to compile it to a single phar file and then copy it to
sudo cp hosts.phar /usr/local/bin/hosts
sudo chmod a+x /usr/local/bin/hosts
To get a list of options and commands run
hosts without any parameters., (*7)
Currently available commands:, (*8)
hosts add [hostname] [options]to add a host
hosts toggle [hostname] [options]to enable/disable a host
hosts show [options]to show a list of hosts
hosts remove [options]to remove a host from the hosts file
All of the commands have several options and filters, you can check them out by
hosts help [command]., (*9)
This is a work in progress, I'll be adding more commands and modifying existing
This project was built to suit my needs, but if it helps you as well, fantastic! Feel free to contribute with new functionality and/or fixes!, (*10)
Copyright (c) 2013 Luciano Longo, (*11)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:, (*12)
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software., (*13)
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE., (*14)