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

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:

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
.

It prevents you from entering non-alphanumeric characters like $, &, ^, @, #, etc.
, because some systems can't handle executable names with those characters.
Clif will also prevent you from naming your program the same as common utilities like ls, pwd, cd, echo, mkdir, mv, cp, cat, rm, export, gzip, wc, ssh
and over 400 others. If you absolutely must use one of these names (we definitely don't recommend it), e-mail support@clif.dev.
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.

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

You've successfully created the program!

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:

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

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.

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

Congratulations! You just finished building your first "hello world" CLI program. Now let's see it in action.
You may have noticed that the following commands also work:$ clif # prints help instructions
$ clif --help # prints help instructions (same as above)
$ clif -h # prints help instructions (same as above)
$ clif --version # prints program version number
$ clif -V # prints program version number (same as above)
When you use the Clif platform to build a CLI, the two options --help
and --version
(and their shorthand -h
and -V
, respectively) automatically work out of the box. Additionally, running clif
by itself will display the help text by default.
All of these default program behaviors represent common conventions and best practices across all CLIs.