Skip to content

mosifa/command-to-json

Repository files navigation

command-to-json

Codacy Badge npm 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.

About

Parses any commands and converts them to JSON

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published