Git Product home page Git Product logo

clerc's Introduction

Clerc Card

Clerc is a full-featured library (tool set) for building CLI Apps in Node.js, Deno or Bun.

Version CI Downloads/week License


Note

This package is ESM-only.

โœจ Features

  • Lightweight - Dependencies are bundled and minified
  • Plugin system - Add rich features on demand.
  • Chainable APIs - Composable.
  • Developer friendly - Strongly typed, converts flags and parameters to camelCase.
  • Parses parameters - No need to read them by yourself.
  • I18N - Easy to change different locales.

๐Ÿ˜Š The simplest CLI example

Install clerc, and create a file named cli.mjs:

import { Clerc } from "clerc";

Clerc.create(
	"foo", // CLI Name
	"A foo CLI", // CLI Description
	"0.0.0", // CLI Version
)
	.command(
		"bar", // Command name
		"A bar command", // Command description
	)
	.on(
		"bar",
		(
			_ctx, // The command context, but we haven't used it yet
		) => {
			console.log("Hello, world from Clerc.js!");
		},
	)
	.parse(); // Parse the arguments and run!

Then run: node cli.mjs bar. It should log in your shell: Hello, world from Clerc.js!

๐Ÿ“– Documentation

Please see https://clerc.js.org.

๐Ÿฆ„ Examples

Check the examples made with Clerc.js:

๐Ÿค” More...

Why using Clerc?

Clerc uses type-flag to parse arguments. It is strongly-typed, which brings you better DX. It is powerful(supports custom type) and quite small!

And clerc uses lite-emit to emit events. It is a event emitter library but with better type support.

The whole bundled and minified @clerc/core package is only 10KB (ignored types), which is much smaller than yargs, commander, CAC and oclif :)

Why naming "Clerc"?

Hiroki Osame's cleye is an awesome tool for building CLI apps. Its name sounds quite nice, so I also found an English name Clerc for this package =)

๐Ÿ“ License

MIT. Made with โค๏ธ by Ray

clerc's People

Contributors

autofix-ci[bot] avatar ifshizuku avatar renovate[bot] avatar so1ve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

clerc's Issues

Add demo to README.md

In order to help your goal of making this project reach 100+ stars, I think you should add demos to the README where people can straight up look at a code sample.

It takes too many clicks (and some scrolling) to get to the "getting started" part where the first snippet is shown.

References:

If you focus on usability (and give a snippet demo), people will definitely see the value in your lib.

EDIT: also, I believe the examples/ folder in clap is all automatically tested, the .md files provide the input in the first line, and the expected output in the rest, so you guarantee that your examples always work.

๐Ÿณ Renovate Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: File contents are invalid JSON but parse using JSON5. Support for this will be removed in a future release so please change to a support .json5 file name or ensure correct JSON syntax.

Pending Approval

These branches will be created by Renovate only once you click their checkbox below.

  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency pkgroll to v2
  • chore(deps): update dependency vite to v5
  • chore(deps): update dependency vitest to v1
  • chore(deps): update dessant/lock-threads action to v5
  • chore(deps): update pnpm to v9
  • fix(deps): update dependency string-width to v7
  • fix(deps): update dependency yoctocolors to v2
  • ๐Ÿ” Create all pending approval PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/autofix-ci.yml
  • actions/checkout v3
  • actions/setup-node v3
  • autofix-ci/action ea32e3a12414e6d3183163c3424a7d7a8631ad84
.github/workflows/ci.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/lock.yml
  • dessant/lock-threads v4
.github/workflows/release.yml
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • @antfu/ni ^0.21.8
  • @so1ve/eslint-config ^2.0.0
  • @so1ve/prettier-config ^2.0.0
  • @types/node ^18.17.18
  • bumpp ^9.2.0
  • eslint ^8.57.0
  • pkgroll ^1.11.0
  • prettier ^3.2.5
  • typescript ^5.2.2
  • vite ^4.4.9
  • vitest ^0.34.4
  • pnpm 8.15.8
packages/clerc/package.json
packages/core/package.json
  • defu ^6.1.2
  • is-platform ^1.0.0
  • lite-emit ^2.3.0
  • type-fest ^4.3.1
  • type-flag ^3.0.0
packages/plugin-completions/package.json
  • @clerc/core *
packages/plugin-friendly-error/package.json
  • kons ^0.7.1
  • @clerc/core *
packages/plugin-help/package.json
  • @types/text-table ^0.2.3
  • string-width ^6.1.0
  • text-table ^0.2.0
  • yoctocolors ^1.0.0
  • @clerc/core *
packages/plugin-not-found/package.json
  • didyoumean2 ^6.0.1
  • yoctocolors ^1.0.0
  • @clerc/core *
packages/plugin-strict-flags/package.json
  • @clerc/core *
packages/plugin-version/package.json
  • @clerc/core *
packages/utils/package.json
  • type-fest ^4.3.1
  • @clerc/core *

  • Check this box to trigger a request for Renovate to run again on this repository

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): lock file maintenance

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v3
  • pnpm/action-setup v2.2.4
  • actions/setup-node v3
  • actions/checkout v3
  • pnpm/action-setup v2.2.4
  • actions/setup-node v3
  • actions/checkout v3
  • pnpm/action-setup v2.2.4
  • actions/setup-node v3
.github/workflows/release.yml
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • @antfu/ni ^0.20.0
  • @babel/types ^7.21.2
  • @mini-cz/config-default ^0.4.1
  • @so1ve/eslint-config ^0.46.0
  • @types/node ^18.14.1
  • bumpp ^9.0.0
  • eslint ^8.34.0
  • mini-cz ^0.4.1
  • pnpm ^7.28.0
  • puild ^1.3.2
  • tsx ^3.12.3
  • typescript ^4.9.5
  • vite ^4.1.4
  • vitest ^0.29.1
  • pnpm 7.26.2
packages/clerc/package.json
packages/core/package.json
  • defu ^6.1.2
  • is-platform ^1.0.0
  • lite-emit ^1.4.0
  • type-fest ^3.6.0
  • type-flag ^3.0.0
packages/plugin-completions/package.json
  • @clerc/core *
packages/plugin-friendly-error/package.json
  • kons ^0.7.0
  • @clerc/core *
packages/plugin-help/package.json
  • @types/text-table ^0.2.2
  • picocolors ^1.0.0
  • string-width ^5.1.2
  • text-table ^0.2.0
  • @clerc/core *
packages/plugin-not-found/package.json
  • didyoumean2 ^5.0.0
  • picocolors ^1.0.0
  • @clerc/core *
packages/plugin-strict-flags/package.json
  • @clerc/core *
packages/plugin-version/package.json
  • @clerc/core *
packages/toolkit/package.json
  • @types/cli-progress ^3.11.0
  • @types/prompts ^2.4.2
  • cli-progress ^3.12.0
  • cli-table3 ^0.6.3
  • execa ^7.0.0
  • kons ^0.7.0
  • open ^8.4.2
  • ora ^6.1.2
  • picocolors ^1.0.0
  • prompts ^2.4.2
  • terminal-columns ^1.4.1
  • terminal-link ^3.0.0
  • @clerc/core *
packages/utils/package.json
  • type-fest ^3.6.0
  • @clerc/core *

  • Check this box to trigger a request for Renovate to run again on this repository

Roadmap

2023

2023.03

  • Mark all packages as esm-only
  • Migrate from picocolors to yoctocolors
  • Add an option to let user modify the sections when the cli help is shown

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.