https://github.com/mosifa/command-to-json
Parses any commands and converts them to JSON
https://github.com/mosifa/command-to-json
command-to-json ifconfig javascript parser tojson typescript
Last synced: 8 months ago
JSON representation
Parses any commands and converts them to JSON
- Host: GitHub
- URL: https://github.com/mosifa/command-to-json
- Owner: mosifa
- License: mit
- Created: 2023-01-22T12:23:02.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-26T10:55:11.000Z (over 2 years ago)
- Last Synced: 2024-04-25T16:42:54.850Z (over 1 year ago)
- Topics: command-to-json, ifconfig, javascript, parser, tojson, typescript
- Language: TypeScript
- Homepage:
- Size: 57.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# command-to-json
[](https://www.codacy.com/gh/mosifa/command-to-json/dashboard?utm_source=github.com&utm_medium=referral&utm_content=mosifa/command-to-json&utm_campaign=Badge_Grade)
[](https://badge.fury.io/js/command-to-json)Parses any commands and converts them to JSON.
## Table of Contents
- [command-to-json](#command-to-json)
- [Installation](#installation)
- [Usage](#usage)
- [Supported commands](#supported-commands)
- [Release notes](#release-notes)## Installation
```sh
npm install command-to-json --save
```## Usage
```ts
import { ifConfig } from 'command-to-json';const output = `
docker0: flags=4099 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](https://en.wikipedia.org/wiki/Ifconfig)## Release notes
See information about breaking changes and release notes [here][1].
[1]: CHANGELOG.md