https://github.com/maximilianmairinger/clicmdast
CLI command ast parser manipulate program bash powershell generic agnostic.
https://github.com/maximilianmairinger/clicmdast
ast bash cli cmd command manipulate mutate parser shell syntax tokenizer
Last synced: about 2 months ago
JSON representation
CLI command ast parser manipulate program bash powershell generic agnostic.
- Host: GitHub
- URL: https://github.com/maximilianmairinger/clicmdast
- Owner: maximilianMairinger
- Created: 2023-02-21T19:43:00.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-22T01:59:11.000Z (over 3 years ago)
- Last Synced: 2025-02-24T00:45:48.188Z (over 1 year ago)
- Topics: ast, bash, cli, cmd, command, manipulate, mutate, parser, shell, syntax, tokenizer
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/cli-cmd-ast
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cli cmd ast
CLI command ast parser manipulate program bash powershell generic agnostic.
> Please note that Cli cmd ast is currently under development and not yet suited for production
## Installation
```shell
$ npm i cli-cmd-ast
```
## Usage
```ts
import { toAst, toCmd } from "cli-cmd-ast"
let yieldsAst = toAst(`npm "--org google" cmd --flag --option1 val -v=1.1`)
yieldsAst = {
cmds: [ 'npm', '--org google', 'cmd' ],
args: { flag: true, option1: 'val', v: 1.1 }
}
```
> Note that the order of commands is not preserved, if one command is after a flag, as this information is not part of the ast.
```ts
let yieldsCmd = toCmd(yieldsAst)
yieldsCmd = `npm "--org google" cmd --flag --option1 val -v=1.1`
```
## Contribute
All feedback is appreciated. Create a pull request or write an issue.