2.0.3 • Published 6 years ago

hfm v2.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

travis npm downloads

Simple, programmatic hosts file manager. Just like nrm.

Install

npm install hfm -g

Usage

If you use OS X or Linux, this module assumes your hosts file is at /etc/hosts. On Windows, it assumes your hosts file is at C:/Windows/System32/drivers/etc/hosts.

help

Print help message for hfm

$ hfm help

  Usage: hfm [options] [command]

  Options:

    -V, --version         output the version number
    -h, --help            output usage information

  Commands:

    list|ls               List origin or local host files alias
    show                  Show all current domain records in hosts file
    alias <name> <path>   Alias a(n) origin/local host file
    del <name>            Unalias a(n) origin/local host file
    set <ip> <domain...>  Set a domain in the hosts file
    remove <domain...>    Remove a set of host entries from URL or local path
    search <domain>       Search related domain records in hosts file
    use <alias>           Use a(n) origin hosts path or an ALIAS_NAME(see `hfm ls`)
    unuse <alias>         Unuse a(n) origin hosts path or an ALIAS_NAME(see `hfm ls`)
    help                  Print help for hfm

list|ls

List origin or local host files alias

$ ./bin/cli.js ls
* Google        https://raw.githubusercontent.com/googlehosts/hosts/master/hosts-files/hosts
* GoogleMirror  https://coding.net/u/scaffrey/p/hosts/git/raw/master/hosts-files/hosts

show

Show all current domain records in hosts file

$ hfm show
# ----------------------------
# SYSTEM
127.0.0.1       localhost
255.255.255.255 broadcasthost

set ip

Set a domain in the hosts file

remove domain

Remove a set of host entries from URL or local path

alias name

Alias a(n) origin/local host file
path could be local path or URL

del name

Unalias a(n) origin/local host file

search domain

Search related domain records in hosts file

$ hfm search \.com$
$ hfm search google.*
$ hfm search www.google.com

use alias

Use a(n) origin hosts path or an ALIAS_NAME(see hfm ls)

$ hfm use Google

unuse alias

Unuse a(n) origin hosts path or an ALIAS_NAME(see hfm ls)