#
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 subcommands
- commands-nested - a script with nested subcommands
#
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
- variables - defining bash variables
- 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
- needs - defining flags that need other flags
- command-private - hiding commands from the command list
- private-reveal - allowing users to reveal private commands, flags or environment variables
- stdin - reading input from stdin
- filters - preventing commands from running unless custom conditions are met
- commands-expose - showing subcommands in the parent's help
- key-value-pairs - parsing key=value arguments and flags
- command-examples-on-error - showing examples on error
#
Customization
- colors-usage - adding colors to the usage text
- command-groups - grouping subcommands 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 validation functions for arguments, flags or environment variables
- 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 subcommands similar to git
#
Documentation generation
- render-mandoc - auto-generate man pages for your script
- render-markdown - auto-generate markdown documentation for your script
#
Other examples
- 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
- kbgrep - a search tool optimized for knowledgebases
- pls - project level shortcut
- 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