Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simon-he95/qargs
https://github.com/simon-he95/qargs
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/simon-he95/qargs
- Owner: Simon-He95
- License: mit
- Created: 2023-03-31T13:52:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-15T17:37:24.000Z (11 months ago)
- Last Synced: 2024-09-18T12:43:14.946Z (about 2 months ago)
- Language: TypeScript
- Size: 66.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: license
Awesome Lists containing this project
README
## @simon_he/qargs
Help you quickly process argv## Install
```bash
npm i @simon_he/qargs
```## Usage
```javascript
import { getArgs } from '@simon_he/qargs'const args = getArgs()
// run --help
args.has('help') // true// run --username simon_he
args.get('username') // simon_he// run --username simon_he --password 123456
args.get(['username','password']) // [simon_he,123456]// run find
args.hasCommand('find') // true
```## Options
```typescript
{
args: string[];
rawArgs: string;
options: Options[];
commanders: string[];
has: (key: string) => boolean;
get: (key: string | string[]) => string | boolean | (string | boolean | undefined)[] | undefined;
hasCommand: (key: string) => boolean;
}
```## License
[MIT](./LICENSE) License © 2022 [Simon He](https://github.com/Simon-He95)
![sponsors](https://www.hejian.club/images/sponsors.jpg)