Skip to content
Documentation
Packages
cerebro
Quick Start

Quick Start

Start building a awesome cli's in under 2 minutes

Visulima Nextra Docs Theme is a theme that includes almost everything you need to build a modern documentation website. It includes a top navigation bar, a search bar, a pages sidebar, a TOC sidebar, and other built-in components.

This website itself is built with the Visulima Nextra Docs Theme.

Start as New Project
Permalink for this section

Install
Permalink for this section

Run the following command to install the dependency:

pnpm i @visulima/cerebro

Create a new bin file
Permalink for this section

For this example we will use bin/cerebro.


import Cli from "@visulima/cerebro";
(async () => {
try {
// Create a CLI runtime
const cli = new Cli("cerebro");
// Your command
cli.addCommand({
description: "Say hello",
execute: ({ logger }) => {
logger.log("Hello, world!");
},
name: "hello",
});
await cli.run();
} catch (error) {
// Abort via CTRL-C
if (error) {
// Throw error
throw error;
} else {
console.log("Goodbye ✌️");
}
}
})();

Ready to Go!
Permalink for this section

With the above created bin file, you can run the following command to say hello:


$ ./bin/cerebro hello // -> Hello, world!

Now you ready to create your own CLI tool with cerebro.