https://github.com/vorpaljs/bash-codegen
Bash source code generator
https://github.com/vorpaljs/bash-codegen
ast bash codegen
Last synced: 10 months ago
JSON representation
Bash source code generator
- Host: GitHub
- URL: https://github.com/vorpaljs/bash-codegen
- Owner: vorpaljs
- Created: 2017-06-22T08:32:01.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-08T07:15:54.000Z (almost 9 years ago)
- Last Synced: 2025-04-22T20:08:43.411Z (about 1 year ago)
- Topics: ast, bash, codegen
- Language: JavaScript
- Size: 2.93 KB
- Stars: 9
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# bash-codegen
> turn bash AST back into code
This module will take an AST and add a property to each node named `source`. This attribute when accessed will return the code value of the node.
## Installation
```
npm install bash-codegen
```
## Usage
> `bash-codegen` will directly edit the AST, to get the bash representation of the AST node, access the source property.
```javascript
const codegen = require('bash-codegen');
const parsed = codegen(ast).commands.map((code) => {
return code.source + '\n';
}).join('');
```
## Contributing
When making code changes, please add details to the `CHANGELOG.md` file under the section `## Unreleased`, if it doesn't exist, please add it.
> example
```
## Unreleased
- changed the way something works // each change is a different bullet
```