Giter Club home page Giter Club logo

cli's Introduction

goodhosts cli, fork of Lex Toumbourou's project goodhosts

codecov Go Reference Go Report Card

Simple hosts file (/etc/hosts) management in a Go cli. One simple interface for any OS or architecture, script and automate hosts file updates using one simple tool.

Features

  • List, add, remove and check hosts file entries from code or the command-line
    • Remove by IP, Host, or IP/Host
    • check returns proper exit codes for scripting e.g. goodhosts check 10.0.5.12 || echo "Missing hosts entry for 10.0.5.12"
  • Clean hostsfile command will
  • Consolidate duplicate IPs
  • Remove duplicate hosts
  • Alpha sort Hosts
  • Sort IPs
  • Help with OS limitations, e.g. 9 hosts per IP line in windows
  • linux/darwin/windows support
  • Custom hosts file support
  • Backup/Restore
  • Quick inline editor (vim/nano)

Installation

Visit the releases page and download the proper binary for your architecture. Unzip and run in place, put in your system path (linux: /usr/local/bin win: ~/bin) for easier access.

Usage

For full usage directions simply call goodhosts -h

$ goodhosts -h
  NAME:
    goodhosts - manage your hosts file goodly

  USAGE:
     goodosts [global options] command [command options] [arguments...]
  
  COMMANDS:
     add, a         Add an entry to the hostsfile
     backup         Backup hosts file
     check, c       Check if ip or host exists
     clean, cl      Clean the hostsfile by doing: remove dupe IPs, for each IPs remove dupe hosts and sort, sort all IPs, split hosts per OS limitations
     debug, d       Show debug table for hosts file
     edit, e        Open hosts file in an editor, default vim
     list, ls       List all entries in the hostsfile
     remove, rm, r  Remove ip or host(s) if exists
     restore        Restore hosts file from backup
     version
     help, h        Shows a list of commands or help for one command
  
  GLOBAL OPTIONS:
     --file value, -f value  override the default hosts: ${SystemRoot}/System32/drivers/etc/hosts
     --debug, -d             Turn on verbose debug logging (default: false)
     --quiet, -q             Turn on off all logging (default: false)
     --help, -h              show help (default: false)

Each sub-command can be called with a -h option to see detailed help information.

 $ ./goodhosts list -h
 NAME:
    goodhosts list - List all entries in the hostsfile

 USAGE:
    goodhosts list [command options] [arguments...]

 OPTIONS:
    --all       Show all entries in the hosts file including commented lines. (default: false)
    --help, -h  show help (default: false)

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.