Skip to content

flowscripter/dynamic-cli-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

127 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dynamic-cli-framework

version build coverage docs license: MIT

A framework for developing CLI applications which supports dynamic discovery and installation of new commands

NOTE: The dynamic aspect is still in development as it relies upon:

So it isn't really dynamic at the moment! 😜

Key Features

  • Flexible CLI definitions:
    • a single default global command with global arguments e.g. executable [global_arguments]
    • multiple sub-commands with sub-command based arguments e.g. executable <sub_command> [sub_command_arguments]
    • multiple grouped member sub-commands with member sub-command based arguments e.g. executable <group_command> <member_sub_command> [member_sub_command_arguments]
    • A mix of the above!
  • Support for both named option and position based arguments e.g. executable --<option_name>=<option_value> <positional_value>
  • Support for specifying multiple values for:
    • named options arguments via either:
      • implicitly indexed repeated arguments e.g. executable --<option_name>=<option_value_1> --<option_name>=<option_value_2>
      • or explicitly indexed arguments e.g. executable --<option_name>[0]=<option_value_1> --<option_name>[1]=<option_value_2>
    • position based arguments ("varargs") e.g. executable <positional_1_value_1> <positional_1_value_2>
  • Support for complex nested options e.g. executable --<option_name>.<property_1_name>=<property_1_value> --<option_name>.<property_1>.<property_1_a>=<property_1_a_value>
  • Support (optional) for persisted configuration and environment variables to specify command argument defaults.
  • Core (but optional) commands for help, logging level and version management.
  • Core (but optional) services for color output (foreground and background), syntax highlighting, pretty printing, table and tree structure rendering, configuration management, and user input prompting.
  • Graceful signal handling (SIGINT/SIGTERM) with shutdown hooks, cooperative cancellation for long-running commands, and triple-interrupt force exit.
  • Core (but optional) support for dynamic discovery and installation of commands and services using dynamic-plugin-framework
  • Minimal dependencies.
  • Bun based.
  • Based on native JavaScript modules.
  • Written in Typescript.
  • Compiled to a binary executable using a Bun runtime.

Usage Examples

The following example projects are available:

  • example-cli is an example CLI application based on this framework.
  • mpeg-sdl-tool is a real world use case CLI application based on this framework.

Further Details

License

MIT © Flowscripter

About

A framework for developing CLI applications which supports dynamic discovery and installation of new commands.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors