Prism: CLI Library (inspired by Golang's Cobra)
Prism
This is a library for building CLI tools written purely in Mojo! It's inspired by the
Cobra package from the Golang ecosystem.https://github.com/thatstoasty/prism
eg
Cobramojo build my_tool.mojo -o my_tool
./my_tool # Prints Pass chromeria as a subcommand!
./my_tool chromeria # Prints Hello from Chromeria!from prism import Command
fn test(command: Arc[Command], args: List[String]) -> None:
print("Pass chromeria as a subcommand!")
fn hello(command: Arc[Command], args: List[String]) -> None:
print("Hello from Chromeria!")
fn main():
var root_command = Arc(
Command(
name="hello",
description="This is a dummy command!",
run=test,
)
)
var hello_command = Arc(Command(name="chromeria", description="This is a dummy command!", run=hello))
root_command[].add_command(hello_command)
root_command[].execute()