Build modern command line apps with Lesy js
Lesy is a super flexible and lightweight CLI framework to build damn good command line apps without too much boilerplate.
Generate a new project
> npx lesy new my-cli
Write your first command
export default {
name: "greet",
run:() => console.log("Hello!")
}
Execute the command
> ./bin/cmd greet
Multiple formats
Commands can be a simple object, class or function. And with efficient file discovery, just provide file path or directory for lookup
Deeply nested sub commands
With just an one line change, run unlimited multi level nested sub commands
Run programatically
For apps like bots, or for complex use case, parse, find and run commands externally
Async execution
Commands are fully suported for async run
... and more
Powerful flag parsing, inbuild utilities, ...
Smart arg parser and command architecture
By keeping all the complex logic under the carpet, lesy surfaces intuitive commands API and powerful mechanism to run them flawlessly. Not just that, commands also packed with tons of cool features.
Learn moreEfforlessly hijack the flow with middlewares
Middlewares are simple functions which will be executed during the lifecyle. With this, you will be able to add new functionallity, tweak and change the entire behaviour of the command at any point of the flow.
Learn moreExtend and tweak the core with plugins
By design, Lesy core is a thin layer of fundamental features which allows to extend the capabilities by adding extensions.
There are quite a few official plugins available for most common use cases like, automatic help generation, scaffolding, prompting, Web Interface, and more.
Run commands from web interface
Pilot Dashboard is one of the lesy plugins which allows you to view and run commands of any lesy projects from web UI. Pilot comes with inbuild customizable console panel, config viewer, prompt modal support, responsive layout and more.
Learn morePaint and redraw interface elements
Artist UI is an another cool plugin which helps you to render dynamic elements by updating the screen content on data change.
Artist can also be used independently without lesy, and it comes with commonly used interface elements like, spinner, progress bar, log, colors, layout, and much more. Also, Artist can be extended with plugins!
import { resolve } from "path";
import { LesyTestBed } from "@lesy/testbed";
import greetCmd from "../greet";
describe("CLI", () => {
let app;
beforeAll(() => {
app = new LesyTestBed({
root: resolve(__dirname, "./"),
commands: [greetCmd],
});
});
it("should log proper output", async () => {
let response = await app.run(["greet"]);
expect(response).toContain("hello!");
});
});
Unit and integration testing made simpler
With Lesy TestBed API, test your commands, middlewares, features and plugins without much boilerplate code.
Learn moreLesy is just faster and performant
Though lesy does too many things, it is still faster by executing only necessary code.
Learn moreLesy has more for you
If you are still hungry, here's some more features you might like
Configurable
Whether it is a simple global/local config or from config file, its just easy
Toolkit
Add new features and share between commands and middlewares using toolkit
Typescript
Write in typescript with full types support without any additional setup
Lesy CLI
Scaffold new project and run Pilot web UI
Plugins plugin
Allow plugin support to own or community plugins
Inbuilt utils
Bundled with inbuilt utils to work with colors and spinner
Subscribe for latest news
We wont send you spams or any nonsense mails!