0.1.1 • Published 1 year ago

command-to-json v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

command-to-json

Codacy Badge GitHub version

Parses any commands and converts them to JSON.

Table of Contents

Installation

npm install command-to-json --save

Usage

import { ifConfig } from 'command-to-json';

const output = `
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    inet 172.0.0.1  netmask 255.255.0.0  broadcast 172.0.0.255
    ether 01:01:01:01:01:01  txqueuelen 0  (Ethernet)
`;

const result = ifConfig.parse(output);
/**
 * result:
 [
    {
      name: 'docker0',
      flags: [ '4099', 'UP', 'BROADCAST', 'MULTICAST' ],
      mtu: '1500',
      inet: '172.0.0.1',
      netmask: '255.255.0.0',
      broadcast: '172.0.0.255',
      ether: '01:01:01:01:01:01',
      txqueuelen: '0'
    }
  ]
 */

Supported commands

if-config

Release notes

See information about breaking changes and release notes here.