FLI
A library for creating command line apps in rust inspired by the like of commander.js
Changes
For stable changes check the CHANGELOG.md file
For unstable changes check the CHANGELOG.md file
then run it like this
Getting started
Installtion
OR
[]
= "0.0.1"
Import
extern crate fli;
use Fli;
Create an App Instance
Adding Options
// callback for the greet param
Run your app
Adding a new Command Set
You can also add a new command set using the command method
Then you would run the command like this
$ cargo run -- move -d .
file(s) moved successfully in 0.8s
Doing it in a procedual way
Like commander.js you can also do it in a procedual way
Explaining all app : Fli
methods
Note:
All
app : Fli
methods are avaliable asapp : &Fli
methods
-
app.option(arg_and_data, callback)
: This method takes in 2 param- First
arg_and_data
: This is a format template of how the avaliable arguments for a command would be being in a format-a --arg
or-a --arg, data
where-a
is the short form of the argument and--arg
is the long form of the argument.--data
is the acceptable data type and it is seperated by a comma,
, if not passed then the arg does not need a data type
symbol meaning [] This means it needs one optional data <> This means it needs one required data [...] This means it can take in many optional data <...> This means it needs at least one data, can take more - First
-
app.commad(command_name)
: This is to create a new command with its own option and param like this Get the app general help option
$ my-app --help
Get the move command help option
$ my-app move --help # a new command called
The app command returns a new refrence instance of Fli