https://github.com/thecodeah/quicli
Create CLI's quickly without any external files!
https://github.com/thecodeah/quicli
cli dev-tool lightweight nodejs
Last synced: 7 months ago
JSON representation
Create CLI's quickly without any external files!
- Host: GitHub
- URL: https://github.com/thecodeah/quicli
- Owner: thecodeah
- License: unlicense
- Created: 2021-03-12T15:37:01.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-08-07T13:46:30.000Z (over 3 years ago)
- Last Synced: 2025-07-05T07:01:51.688Z (7 months ago)
- Topics: cli, dev-tool, lightweight, nodejs
- Language: TypeScript
- Homepage: https://quicli.js.org
- Size: 443 KB
- Stars: 26
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README

## Why QuiCLI?
QuiCLI is a lightweight CLI framework that was intentionally designed to be used without a package manager or any external files. The built code has no dependencies and is entirely minified into a single line. Paste it on top of a new `.js` file and you're ready to go! No `package.json`, no `node_modules` and your colleagues don't have to install any global packages making it a great cross-platform alternative to shell scripts in development environments.
When creating CLI's with QuiCLI, the goal of the program should be to assist development. It's not meant to be used to create CLI's that will eventually be provided to end-users. There are better, and more feature-rich CLI frameworks that can help you achieve that goal.
## Getting started
1. Simply copy and paste the contents of the `lib/quicli.min.js` file in this repository to a new `.js` file.
2. On a new line below the pasted contents, add some commands (Check the examples below).
3. Run your CLI with `node myapp mycommand`.
## Features
### Nested commands
```js
cli.addCommand("foo.bar", (flags) => {
cli.log("Hello world!");
})
```
```
> node myapp foo bar
Hello world!
```
### Typed flags
```js
cli.addCommand("foo", (flags) => {
cli.log(flags.bar[0], "is a nice number!");
})
.addFlag("bar", "number", true) // Name, Type, Required
```
```
> node myapp foo
Missing flag: bar
> node myapp foo --bar hello
Incorrect type: bar must be a number!
> node myapp foo --bar 24
24 is a nice number!
```
### Input handling
```js
cli.addCommand("foo", async (flags) => {
const answer = await cli.question("What's up?");
cli.log("Your answer: " + answer);
})
```
```
> node myapp foo
What's up? Nothing much...
Your answer: Nothing much...
```
### Styled output
```js
cli.addCommand("ping", (flags) => {
cli.log(
$.BOLD +
$.RED + "P" +
$.YELLOW + "O" +
$.GREEN + "N" +
$.BLUE + "G" +
$.MAGENTA + "!"
);
})
```
## Documentation
Documentation can be found on [the projects website](http://quicli.js.org).