# Examples

The examples folder in the GitHub repository contains many detailed and documented example configuration files, with their output.

View Examples on GitHub

All examples are listed below for convenience.

# Basic use

# Basic features

# 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 with stdin 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

# 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

# Bashly library features

  • config-ini - using the config (INI) functions
  • colors - using the color print feature
  • yaml - using the YAML reading functions
  • completions - adding bash completion functionality
  • validations - adding argument validation functions

# 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.