Skip to content

LLM Resources

What is clippium? ​

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 ​

bash
npm install clippium
bash
pnpm install clippium
bash
yarn add clippium
bash
bun add clippium
bash
deno 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

Read more

Init ​

Init a Clippium CLI

Read more

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

Read more

πŸ› οΈ 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 ​

js
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 ​

js
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 ​

js
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

}