https://github.com/adamjosefus/allo_arguments
🦕 Super handy cli argument parser with automate generation `--help` flag.
https://github.com/adamjosefus/allo_arguments
argument-parser arguments cli deno typescript
Last synced: about 1 month ago
JSON representation
🦕 Super handy cli argument parser with automate generation `--help` flag.
- Host: GitHub
- URL: https://github.com/adamjosefus/allo_arguments
- Owner: adamjosefus
- Created: 2021-08-31T21:48:40.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-12-06T17:02:04.000Z (over 3 years ago)
- Last Synced: 2025-07-09T00:43:23.865Z (12 months ago)
- Topics: argument-parser, arguments, cli, deno, typescript
- Language: TypeScript
- Homepage:
- Size: 90.8 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **Allo Arguments** for Deno 🦕
A library for Deno that parses the terminal's input parameters.
It allows you to assign default values to them, process them and automatically generate a message for `--help`.
## Example
```ts
import { join } from "https://deno.land/std/path/mod.ts";
import { Arguments, ExpectedException } from "https://deno.land/x/allo_arguments/mod.ts";
function getArguments() {
const args = new Arguments({
...Arguments.createHelpOptions(),
'myString': {
shortName: 's',
description: 'This is a string flag.',
convertor: Arguments.stringConvertor,
},
'myNumber': {
shortName: 'n',
description: 'This is a number flag.',
convertor: Arguments.numberConvertor,
default: () => 0
},
'myBoolean': {
shortName: 'b',
description: 'This is a boolean flag.',
convertor: Arguments.booleanConvertor,
},
'myCustom': {
shortName: 'c',
description: 'This is a custom flag.',
convertor: value => {
if (value === undefined) return undefined;
return `🐰 — ${value} — 🐭`;
},
},
'myDeprecated': {
convertor: Arguments.stringConvertor,
excludeFromHelp: true
},
})
.setDescription("This is a demo of the arguments library.")
// Important for `--help` flag works.
if (args.isHelpRequested()) args.triggerHelp();
return args.getFlags();
}
try {
const args = getArguments();
console.log(args);
} catch (error) {
Arguments.rethrowUnprintableException(error);
}
```
## Documentation 📖
Description of all classes and methods will found in the [documentation](https://doc.deno.land/https://deno.land/x/allo_arguments/mod.ts).
---
Check out other [ours packages 📦](https://deno.land/x?query=allo_)!