[go: up one dir, main page]

prismcli

Haxe CLI Framework inspired by comma and argparse
https://github.com/CCobaltDev/PrismCLI/

To install, run:

haxelib install prismcli 1.2.0 

See using Haxelib in Haxelib documentation for more information.

README.md

PrismCLI

Haxe CLI Framework inspired by comma and argparse

Primarily created to be used in HaxeBeacon

Installation

Run haxelib install prismcli

Usage

Basic CLI with no commands

import prismcli.CLI;

class Main
{
	public static function main():Void
	{
		var cli = new CLI("Basic CLI", "A basic command-less CLI", "1.0.0");
		cli.addDefaults();

		cli.run((cli, args, flags) ->
		{
			cli.print("This is an example CLI.");
		});
	}
}

Basic CLI with a command, argument, and flag

import prismcli.CLI;

class Main
{
	public static function main():Void
	{
		var cli = new CLI("Basic CLI", "A basic CLI with commands", "1.0.0");
		cli.addDefaults();

		var cmd = cli.addCommand("print", "Prints a number", (cli, args, flags) ->
		{
			cli.print("Print command ran - Here's the number. - " + args["number"]);
			if (flags["again"])
				cli.print(args["number"]);
		});
		cmd.addArgument("number", "The number to print", Int);
		cmd.addFlag("again", "Print the number again", ["--again", "-a"], None);

		cli.run();
	}
}
Contributors
CCobaltDev
Version
1.2.0
Published
8 months ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub