#
Examples
The examples folder in the GitHub repository contains many detailed and documented example configuration files, with their output.
All examples are listed below for convenience.
#
Basic use
- minimal - the most basic "hello world" example
- commands - a script with sub-commands
- commands-nested - a script with nested sub-commands
#
Basic features
- command-default - configuring a default command
- command-default-force - configuring a default command that runs instead of showing the usage text
- command-aliases - allowing a command to be called with multiple names
- command-examples - configuring command examples
- dependencies - halting script execution unless certain dependencies are installed
- dependencies-alt - halting script execution unless one of the required dependencies is installed
- environment-variables - halting script execution unless certain environment variables are set
- default-values - arguments and flags with default values
- minus-v - using
-v
and-h
in your script - multiline - help messages with multiple lines
#
Advanced configuration features
- catch-all - a command that can receive an arbitrary number of arguments
- catch-all-advanced - another example for the
catch_all
option - catch-all-stdin - combining
catch_all
withstdin
to read multiple files - extensible - letting your script's users extend the script
- extensible-delegate - extending your script by delegating commands to an external executable
- whitelist - arguments and flags with a predefined allowed list of values
- repeatable-arg - allowing arguments to be provided multiple times
- repeatable-flag - allowing flags to be provided multiple times
- reusable-flags - reuse flag definition for multiple commands
- conflicts - defining mutually exclusive flags
- command-private - hiding commands from the command list
- stdin - reading input from stdin
- filters - preventing commands from running unless custom conditions are met
- commands-expose - showing sub-commands in the parent's help
#
Customization
- colors-usage - adding colors to the usage text
- command-groups - grouping sub-commands in logical sections
- custom-strings - configuring the script's error and usage texts
- custom-includes - adding and organizing your custom functions
- custom-script-header - configuring a different script header
- footer - adding a footer to the help message
- command-filenames - overriding filenames for your source scripts
- command-paths - configuring nested paths for your source scripts
- command-function - configuring custom internal function names
- split-config - splitting your
bashly.yml
into several smaller files
#
Bashly library features
- config - using the config library for easy access to INI files
- ini - using the ini library for direct, low level access to INI files
- yaml - using the YAML reading functions
- colors - using the color print feature
- completions - adding bash completion functionality
- validations - adding argument validation functions
- hooks - adding before/after hooks
#
Real-world-like examples
- docker-like - a sample script with deep commands (like
docker container run
) - git-like - a sample script with sub-commands similar to git
#
Documentation generation
- render-mandoc - auto-generate man pages for your script
#
Other examples
- heredoc - using heredoc strings
- heredoc-alt - using heredoc strings in the lib directory
- settings - using the
settings.yml
file to adjust bashly's behavior - help-command - adding a help command to your script
#
Real world examples
These tools were developed using bashly. You can review their code to learn more about using bashly.
- Alf - a generator for bash aliases and sub-aliases
- git-changelog - a change log generator
- Respec - a convenience wrapper for ruby's rspec
- Rush - a Personal Package Manager
- slack-emoji-toolkit - liberate your custom Slack emojis
- orcli - OpenRefine command line interface