ylxdzsw / Fire.jl
Licence: other
Fire.jl is a library for automatically generating command line interfaces (CLIs) for julia functions.
Stars: ✭ 40
Programming Languages
julia
2034 projects
Labels
Projects that are alternatives of or similar to Fire.jl
Cli
GraphQL back-end framework with first-class Typescript support
Stars: ✭ 37 (-7.5%)
Mutual labels: cli
Kotlin Cli
Kotlin-CLI - command line interface options parser for Kotlin
Stars: ✭ 37 (-7.5%)
Mutual labels: cli
Fuego
fuego is a library for automatically generating command line interfaces (CLIs) from function and struct.
Stars: ✭ 37 (-7.5%)
Mutual labels: cli
Kubetop
Kubernetes nodes, pods, services, and deployments in a glance
Stars: ✭ 37 (-7.5%)
Mutual labels: cli
Cli Badges
Quirky little node-js library for generating badges for your cli apps.
Stars: ✭ 39 (-2.5%)
Mutual labels: cli
Sdk
Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
Stars: ✭ 996 (+2390%)
Mutual labels: cli
Rocket.chat.apps Cli
The CLI for interacting with Rocket.Chat Apps
Stars: ✭ 37 (-7.5%)
Mutual labels: cli
Pos
A command-line utility for tagging part of speech for words in text.
Stars: ✭ 39 (-2.5%)
Mutual labels: cli
Sqlite Global Tool
SQLite .NET Core CLI tool that allows the user to manually enter and execute SQL statements with or without showing query result.
Stars: ✭ 37 (-7.5%)
Mutual labels: cli
Snoo
A Reddit command line client written in Node.js, using modern ES-features
Stars: ✭ 39 (-2.5%)
Mutual labels: cli
Spinnercpp
Simple header only library to add a spinner / progress indicator to any terminal application.
Stars: ✭ 37 (-7.5%)
Mutual labels: cli
Curriculum
Overview of the different modules and learning goals of the program.
Stars: ✭ 40 (+0%)
Mutual labels: cli
Dw Cli
A command line utility for Salesforce Commerce Cloud (Demandware) SIG and PIG development.
Stars: ✭ 39 (-2.5%)
Mutual labels: cli
Fire.jl
Fire.jl is a library for creating simple CLI from julia function definitions.
Installation
Pkg.add("Fire")
Basic Usage
- put
using Fire
into your file - put
@main
in front of your entry functions - (optional) add shebang and chmod to save a word in commandline
- enjoy
using Fire
"Your Doc String"
@main function repeat_string(message::AbstractString, times::Integer=3; color::Symbol=:normal)
times < 0 && throw(ArgumentError("cannot repeat negative times"))
for i in 1:times
print_with_color(color, message)
end
end
Then you can call repeat_string
at commandline (assume the file is called "example.jl")
$ julia example.jl hello
hello
hello
hello
$ julia example.jl "hello world!" 1
hello world!
$ julia example.jl "hello world!" 1 --color red
hello world!
$ julia example.jl "hello world!" badguy
Error parsing positional argument `times`: require `Integer`, but got "badguy"
`--help` for usages
$ julia example.jl --help
Your Doc String
Positional Arguments:
str: AbstractString
times: Integer (default: 3)
Optional Arguments:
color: Symbol (default: normal)
Multiple entries are supported. You can call each function by name.
using Fire
@main function is_odd(x::Integer)
x == 0 ? println("false") : is_even(x-sign(x))
end
@main function is_even(x::Integer)
x == 0 ? println("true") : is_odd(x-sign(x))
end
$ julia example.jl is_odd 3
true
$ julia example.jl is_even 3
false
Why is it called Fire?
This package is highly inspired by python-fire
Details
Supported Types
- String / AbstractString / Symbol
- "basic" number types like
Int32
,AbstractFloat
, etc. - VarArgs of above types
- Vector of above types is allowed in optional arguments
- Bool is allowed in optional arguments, and will be parsed as flag
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].