Skip to content

How to write a simple cbf script

Joshua Vernon edited this page Jan 3, 2020 · 4 revisions

Simple scripts are made up of options and commands.

  1. The first tag is required and is the scripts name
  2. options are stored as keys
  3. commands are stored as values

Using yaml

  1. Choose a name for your CLI e.g. hello
  2. Add an option for users to select to run the command
  3. That's it 😊
hello:
  world: "echo 'Hello, world!'"
  mars: "echo 'Hello, mars!'"
  jupiter: "echo 'Hello, jupiter!'"

Using json

  1. Choose a name for your CLI e.g. hello
  2. Add an option for users to select to run the command
  3. Wrap it all in some braces 😊
{
  "hello": {
    "world": "echo 'Hello, world!",
    "mars": "echo 'Hello, mars!",
    "jupiter": "echo 'Hello, jupiter!"
  }
}

You can fine more example advanced scripts here.

Usage

Save it to cbf

$ cbf -s hello.json

Run it with cbf

$ cbf -r hello

Check out cbf's 🦥 site to get started!

Clone this wiki locally