https://github.com/ubermanu/as-command
A command line arguments parser for AssemblyScript
https://github.com/ubermanu/as-command
args-parser assembly-script command
Last synced: 10 months ago
JSON representation
A command line arguments parser for AssemblyScript
- Host: GitHub
- URL: https://github.com/ubermanu/as-command
- Owner: ubermanu
- License: mit
- Created: 2023-09-14T11:09:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-15T10:49:10.000Z (almost 2 years ago)
- Last Synced: 2025-04-01T12:49:41.872Z (10 months ago)
- Topics: args-parser, assembly-script, command
- Language: TypeScript
- Homepage:
- Size: 185 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# as-command
A command line arguments parser for [AssemblyScript](https://www.assemblyscript.org/).
## Installation
```sh
npm install as-command --save
```
## Usage
```ts
import command from 'as-command'
const program = command
.name('pizza-cli')
.version('4.1.79')
.description('Order your pizza')
.option('-c, --cheese', 'Add the specified type of cheese [marble]', [
'marble',
])
.option('-p, --peppers', 'Add peppers')
.option('-t, --tomatoes', 'Add tomatoes')
.action((args) => {
console.log(`Preparing pizza with:`)
if (args.has('cheese')) {
console.log(`+ cheese: ${args.get('cheese').join(', ')}`)
}
if (args.has('peppers')) {
console.log('+ peppers')
}
if (args.has('tomatoes')) {
console.log('+ tomatoes')
}
})
program.parse(process.argv)
```