Kapsis β Build delightful command line interfaces with Nim language π
nimble install kapsis
- Generates Commands & Subcommands based on Nim's Macros
- CLI flat file Database
JSON
,MessagePack
,LMDB
orSQLite
- Plugins. Extend your CLI functionality
- Self Updater
- Auto-Generates Bash/ZSH Completion scripts
-
Variants
usingtuple
syntax(git|svn)
- Short/Long Flags
-r
,--run
- Colors, many colors π
- ASCII & Gradientful Preloaders β³
- Prompters as
Input
,Dropdown
,Secret
,Checkbox
,Radio
- Fullscreen Sessions π
- Keyboard Events β₯
- Tables and Alignments π
- UX - Highlight command for invalid inputs π§
- UX - Extra comments per command using
-h
- Written in Nim language π
- Open Source |
MIT
License
Compile with -d:debugcli
to show generated commands at compile-time
import kapsis
import ./commands/[newCommand, helloCommand, helloWorldCommand]
App:
about:
# Optional. When not provided will use .nimble info
"π Yay! My command line interface"
commands:
--- "Main commands" # separator
$ "new" ("app", "rest"):
? "Create a new project" # describe your command
? app "Create a new WEB project" # describe a specific argument
? rest "Create a new REST API project"
--- "Dev stuff" # separator with text
$ "hello" `input` ["jazz"]:
? "A second command"
$ "hello.world":
? "A sub command"
Once compiled run myapp -h
to print:
π Yay! My command line interface
Main commands:
new app|rest Create a new project
Dev stuff:
hello <input> --jazz A second command
hello.world A sub command
Append a command with -h
to show all flags/arguments, including description, for example
myapp new -h
Note: -h
/--help
and -v
/--version
are built-in flags (version is extracted from .nimble
file)
Each registered command requires an import statement.
If you add a new command called new
, first you will need to import your command,
which in this case should be named newCommand.nim
.
This is your newCommand.nim
import kapsis/runtime
proc runCommand*(v: Values) =
# my stuff
Do the do. Add more examples
- π Found a bug? Create a new Issue
- π Wanna help? Fork it!
- π Get β¬20 in cloud credits from Hetzner
- π₯° Donate to The Enthusiast via PayPal address
kapsis
| MIT
license. Made by Humans from OpenPeeps.
Copyright Β© 2023 OpenPeeps & Contributors β All rights reserved.