Giter Club home page Giter Club logo

hosts-group's Introduction

hosts-group

以组方式管理hosts文件。

Usage

npm install hosts-group
var hosts = require('hosts-group');
/**
*@description 设置一个host
*@param domain [String] 域名
        ip  [String] ip
        options [Object]
        {
            groupName: "",//组名,默认defaultGroup
            disabled: true/false,//true-注释 false-启用,默认false
            note: "",//注释,可选
            olddomain: "",//原域名,可选
            oldip: ""//原ip,可选
        }
*/
hosts.set(domain, ip, options);

/**
*@description 删除一个host
*@param domain [String] 域名
        ip [String] ip
        groupName  [String] 组名,默认defaultGroup
*/
hosts.remove(domain, id, groupName);

/**
*@description 添加一个分组
*@param groupName [String] 组名
        note  [String] 注释,可选
*/
hosts.addGroup(groupName, note);

/**
*@description 设置修改分组名
*@param oldName [String] 组名
        newName [String] 组名
*/
hosts.setGroup(oldName, newName);

/**
*@description 删除一个分组
*@param groupName [String] 组名
*/
hosts.removeGroup(groupName);

/**
*@description 将一个host移动到另一个分组
*@param domain [String] 域名 
        ip [String] ip
        groupName [String] 原组名
        target_groupName [String] 目标组名
*/
hosts.move(domain, ip, groupName, target_groupName);

/**
*@description 注释一个host
*@param domain [String] 域名 
        ip [String] ip
        groupName [String] 组名,默认defaultGroup
*/
hosts.disable(domain, ip, groupName);

/**
*@description 启用一个host
*@param domain [String] 域名
        ip [String] ip
        groupName [String] 组名,默认defaultGroup
*/
hosts.active(domain, ip, groupName);

/**
*@description 注释一个组的host
*@param groupName [String] 组名
*/
hosts.disableGroup(groupName);

/**
*@description 启用一个组的host
*@param groupName [String] 组名
*/
hosts.activeGroup(groupName);

License

MIT license

hosts-group's People

Contributors

rk-wjw avatar xiaojue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.