o
odinpkg.dev
packages / tool / cli

cli

19af90dtool

A simple cli tool for Odin

MIT · updated 11 months ago

cli

A simple package to build command line apps in Odin.

An example

package main

import "cli"
import "core:fmt"
import "core:strings"


action :: proc(app: cli.App, manager: cli.Manager) {
    fmt.println(strings.join(manager.args[2:], " "))
}


main :: proc() {
    app := cli.App {
        description = "This is my simple cli tool!",
    }

    cli.add(&app, &cli.Command{name = "echo", action = action})
    err := cli.run(&app)
}

To use your cli compile your code and move it into your path, it should look something like this:

odin run app.odin -file -out:app
app echo Hello World!
> Hello World!