Get started quickly

Let's get started by building a really simple "hello world" CLI program. You're going to build this CLI:

Hello world CLI program spec

It's basically the clif command with a single sub-command hello that greets you with "Hello world!".

This is best learned if you follow along. To do that, sign up for a free account on the Clif platform.

Step 1: Create a new program

First click "Create program" on your Clif platform dashboard:

Create a new CLI program on Clif

You'll be asked to name the program. It will only allow you to enter lowercase letters and certain special characters like "-", "_".

For this walkthrough, call it clif.

Name your CLI program on Clif

It prevents you from entering non-alphanumeric characters like $, &, ^, @, #, etc., because some systems can't handle executable names with those characters.

Then give it a one-line summary and a longer description. The description can span multiple lines, but don't go overboard because whenever the user calls the --help for the command, it will show the entire description. You can always look at the preview to get a sense of whether it's too much info for users.

Provide a summary and description for the CLI program

Finally, give it an author (this can be your name or your company's name), then click Create program.

Provide an author for the CLI program

You've successfully created the program!

CLI program successfully created
Step 2: Build your first command: clif hello

The simple command you're going to build is hello and it will give you the warm greeting "Hello world!".

Go the CLI editor for clif if you're not already there:

CLI editor zero state

Create a new command by clicking the New command button on the left panel. It will ask a couple questions, so answer as follows:

  • Name: hello
  • Short description: a hello world first command
Create a new CLI command form

Once the command is created, in the right panel you can control what it will do. Go ahead and click the + button on the right panel under the Start step.

You want this command to simply output the text "Hello world!", so go ahead and choose the Output standard step type.

Add a new step to the command logic

Then enter the static text "Hello world!" For those who are familiar with computer programming, this is essentially writing text to stdout.

Output text Hello world!

Congratulations! You just finished building your first "hello world" CLI program. Now let's see it in action.

Next - Level up: lookup command