Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webpod/ingrid
A shell-printed tables parser
https://github.com/webpod/ingrid
Last synced: about 13 hours ago
JSON representation
A shell-printed tables parser
- Host: GitHub
- URL: https://github.com/webpod/ingrid
- Owner: webpod
- License: mit
- Created: 2024-03-21T08:08:27.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-29T11:05:09.000Z (8 months ago)
- Last Synced: 2024-08-09T13:44:59.050Z (3 months ago)
- Language: TypeScript
- Size: 118 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @webpod/ingrid
> A shell-printed tables parser## Usage
There are so many tools for printing tables in the shell, but much less to parse them back.```ts
import { parse } from '@webpod/ingrid'const table = `
foo bar baz
1 2 3
`
const result = parse(table.trim())
// {foo: ['1'], bar: ['2'], baz: ['3']}
```To parse [wmic](https://en.wikipedia.org/wiki/Windows_Management_Instrumentation) grids, set the `format` option:
```ts
const table = `
foo bar baz
12 3
a
b c
d e
`const result = parse(table.trim(), {format: 'win'})
/**
[
{ foo: ['1'], bar: ['2'], baz: ['3'] },
{ foo: ['a'], bar: ['b'], baz: ['c'] },
{ foo: ['a'], bar: ['d'], baz: ['e'] }
]
*/
```## License
[MIT](./LICENSE)