What is clippium? β

clippium is a tool that helps to create command line interfaces (CLI) with powerful and pristine operations.
βΉοΈ The first version is now available. Feel free to report any issues here
π Installation β
npm install clippiumpnpm install clippiumyarn add clippiumbun add clippiumdeno add clippiumπ Features β
π Easy to Use: Simple setup with minimal configuration required.
β‘ Fast: Optimized for quick execution and minimal overhead. Read more
π¦ lightweight: Zero dependencies and a small package
π Available for:
- π’ Node.js
- π¦ Deno
- π Bun
- π Browser
βοΈ Customizable:
- Change the help format, version, and error output.
- Create style themes for your CLIs.
π¨ Presets β
- Colored: Add color to help output.
- Default: Add standard flags like --help or --version.
- Config: Add configuration file support.
π§° Toolkit β
A CLI toolkit to initialize, convert, transform, and create documentation for your Clippium CLI. Read more
Create documentation β
Create documentation from your Clippium CLI
Init β
Init a Clippium CLI
Conversion utils β
Convert to and from Clippium CLI data. Convert json schemas, openapi schemas, js functions, typescript types etc to a Clippium CLI and vice versa
π οΈ Extra tools β
- Color: Add color support to your text (with browser support).
- i18n: Add Internalization to your CLI (with browser support).
- Updater: Add updater notification to your CLI.
π Usage β
Use with class β
import { Clippium } from 'clippium'
const cli = new Clippium( data )
cli.fn = async data => {
// do something
}
await cli.run( process.argv.slice( 2 ) )Use with functions β
import process from 'node:process'
import { hideBin, defineData, parse } from 'clippium'
const data = defineData({ ... })
const argv = hideBin( process.argv )
const {
flags,
positionals,
commands
} = parse( {argv, data} )
// do somethingπ‘ Examples β
import { Clippium, hideBin, defineData } from 'clippium'
const data = defineData({
name: 'my-cli',
description: 'My CLI',
version: '1.0.0',
flags: {
help: {
alias: 'h',
description: 'help mode',
type: 'boolean',
},
},
commands: {
dev: {
description: 'Run development server',
flags: {
port: {
alias: 'p',
description: 'Port to run the server on',
type: 'number',
default: 3000,
},
watch: {
alias: 'w',
description: 'Watch for changes and reload the server',
type: 'boolean',
},
},
}
}
})
const argv = hideBin( process.argv )
const cli = new Clippium( data )
const { flags, commands } = cli.parse(argv)
if ( flags.help ) console.log( cli.getHelp(argv) )
else if ( commands.dev ) {
console.log( `Running development server on port ${flags.port || 3000}` )
if ( flags.watch ) console.log( 'Watching for changes...' )
// run development server here
}