### Install Curl Example Source: https://github.com/bashly-framework/bashly/blob/master/spec/approvals/rendering/mandoc/dependencies-alt/cli-download.md This command shows how to install curl using apt, a common dependency for downloading. ```bash sudo apt install curl ``` -------------------------------- ### Bashly CLI: Get Command Example Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/ini/README.md Illustrates the output of the 'get' command when retrieving an existing key ('hello'). ```shell hello = world ``` -------------------------------- ### Basic Download Example Source: https://github.com/bashly-framework/bashly/blob/master/spec/approvals/libraries/render/markdown/render-1-index.md A simple example demonstrating how to download a file from a URL without specifying a target filename. The file will be saved with its original name. ```bash download example.com ``` -------------------------------- ### Download File Example Source: https://github.com/bashly-framework/bashly/blob/master/spec/approvals/libraries/render/mandoc/render-1-download.md Illustrates basic usage of the download application. Specify the source URL and optionally a target filename. ```bash download example.com ``` ```bash download example.com ./output -f ``` -------------------------------- ### Bashly Configuration with Examples Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-examples/README.md Defines the structure of a bashly application, including commands, arguments, flags, and examples. Examples can be provided as a simple array of strings or a multi-line string for more control over formatting. ```yaml name: cli help: Sample application version: 0.1.0 commands: - name: download alias: d help: Download a file args: - name: source required: true help: URL to download from - name: target help: "Target filename (default: same as source)" flags: - long: --force short: -f help: Overwrite existing files # Examples can be provided either as an array, or as a string. # The array form is convenient when you just want to provide one-liner # examples. examples: - cli download example.com - cli download example.com ./output -f - name: upload alias: u help: Upload a file args: - name: source required: true help: File to upload flags: - long: --user short: -u arg: user help: Username to use for logging in required: true - long: --password short: -p arg: password help: Password to use for logging in # The string form examples is useful when you wish to have more control # over how the examples are displayed. Note the use of the '|-' marker # that tells YAML to use the string as is, including the newlines it contains. examples: |- Upload a file $ cli upload profile.png -u admin -p s3cr3t Upload a file (you will be prompted to provide a password) $ cli upload profile.png --user admin ``` -------------------------------- ### Get Command Example Output (`$ ./configly get theme`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/config/README.md Retrieves the value of the 'theme' key. The output shows the value is printed multiple times due to the implementation in `src/get_command.sh`. ```shell dark dark dark ``` -------------------------------- ### Execute Download Command Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-default/README.md This example demonstrates executing the `download` command with an argument. The implementation file `src/download_command.sh` is generated. ```shell # This file is located at 'src/download_command.sh'. # It contains the implementation for the 'ftp download' command. # The code you write here will be wrapped by a function named 'ftp_download_command()'. # Feel free to edit this file; your changes will persist when regenerating. args: - ${args[source]} = something ``` -------------------------------- ### Get Command Example Output (`$ ./configly get invalid_key`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/config/README.md Attempts to retrieve a non-existent key 'invalid_key'. Shows the 'No such key' message and the default value provided. ```shell No such key: invalid_key the default value ``` -------------------------------- ### Display Help for Nested Command Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-function/README.md Shows the help output for the nested `container start` command. ```shell $ ./cli container start --help cli container start - Start a new container Usage: cli container start cli container start --help | -h Options: --help, -h Show this help ``` -------------------------------- ### Set Command Example Output (`$ ./configly set theme dark`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/config/README.md Demonstrates setting the 'theme' to 'dark' and shows the updated configuration content. ```shell theme = dark user.email = paul@section.one user.name = Operations ``` -------------------------------- ### Bashly CLI Commands for Setup Source: https://github.com/bashly-framework/bashly/blob/master/examples/stacktrace/README.md Commands to initialize a minimal Bashly project, add the stacktrace functionality, and generate the application. ```bash $ bashly init --minimal $ bashly add stacktrace $ bashly generate # ... now create and edit src/initialize.sh to match the example ... # ... now edit src/root_command.sh to match the example ... $ bashly generate ``` -------------------------------- ### Sample INI Configuration File (`config.ini`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/config/README.md An example INI file demonstrating a simple configuration structure with a theme and a user section. ```ini theme = dark [user] email = paul@section.one name = Operations ``` -------------------------------- ### Get Command Example Output (`$ ./configly get user.name`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/config/README.md Retrieves the value of the 'user.name' key. The output shows the value is printed multiple times due to the implementation in `src/get_command.sh`. ```shell Operations Operations Operations ``` -------------------------------- ### Initialize Bashly Project Source: https://github.com/bashly-framework/bashly/blob/master/examples/repeatable-arg/README.md Use this command to create a new Bashly project. You will then edit `bashly.yml` and `src/root_command.sh` to match the example. ```bash $ bashly init # ... now edit src/bashly.yml to match the example ... # ... now edit src/root_command.sh to match the example ... $ bashly generate ``` -------------------------------- ### Get Command Implementation (`src/get_command.sh`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/config/README.md Implements the 'get' command to read a value from the configuration. Shows how to check for key existence, retrieve a value, and assign it to a variable. ```bash # Using the standard library (lib/config.sh) to show a value from the config key="${args[key]}" if config_has_key "$key"; then config_get "$key" else echo "No such key: $key" fi # Or, assign a default value if value not found config_get "$key" "the default value" # Or, assign the result to a variable result=$(config_get "$key") echo "$result" ``` -------------------------------- ### mygit Usage Example Source: https://github.com/bashly-framework/bashly/blob/master/spec/approvals/rendering/markdown/extensible-delegate/index.md This shows the basic command structure for using the mygit application. Any command not explicitly defined by mygit will be delegated. ```bash mygit COMMAND ``` -------------------------------- ### CLI Help Output with Options Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-default/README.md This example shows the detailed help message for the `ftp` application, including options, when the `-h` flag is used. ```shell ftp - Sample application that uses the default command option Usage: ftp COMMAND ftp [COMMAND] --help | -h ftp --version | -v Commands: upload Upload a file (default) download Download a file Options: --help, -h Show this help --version, -v Show version number ``` -------------------------------- ### List Command Example Output (`$ ./configly list`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/config/README.md Lists all configuration keys and their values, both from the initial INI file and any set values. Also demonstrates iterating through keys. ```shell theme = dark user.email = paul@section.one user.name = Operations theme === dark user.email === paul@section.one user.name === Operations ``` -------------------------------- ### Example Output for Download Command Source: https://github.com/bashly-framework/bashly/blob/master/examples/variables/README.md Shows the expected output when running the 'download' command with an argument. Variables are correctly substituted. ```shell build_number: 1337 output_folder: output download_sources: - youtube - instagram environments: - dev - stage - production ``` -------------------------------- ### Bashly Initialization and Generation Commands Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-line-manipulation/README.md These bash commands demonstrate the initial setup for a Bashly project, including creating a minimal project, adding hooks, and generating the application. ```bash $ bashly init --minimal $ bashly add hooks # ... now edit src/bashly.yml to match the example ... # ... now edit src/initialize.sh to match the example ... # ... now edit src/before.sh to match the example ... $ bashly generate ``` -------------------------------- ### Bashly Settings File (`settings.yml`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-examples-on-error/README.md Configures global settings for your Bashly application. `show_examples_on_error: true` will display command examples when a required argument is missing. ```yaml show_examples_on_error: true ``` -------------------------------- ### CLI Help for Upload Command Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-default/README.md This example displays the help message specifically for the `upload` command, including its alias, usage, options, and arguments. ```shell ftp upload - Upload a file Alias: u Usage: ftp [upload] SOURCE ftp upload --help | -h Options: --help, -h Show this help Arguments: SOURCE File to upload ``` -------------------------------- ### Install and Run Madness Markdown Server Source: https://github.com/bashly-framework/bashly/blob/master/lib/bashly/libraries/render/markdown/README.md Install the Madness markdown server using RubyGems and then run it to view your markdown files in a browser. Navigate to the `docs` directory to serve its content. ```bash $ gem install madness $ madness server docs ``` -------------------------------- ### Run a Specific Example Test with respec Source: https://github.com/bashly-framework/bashly/blob/master/spec/README.md Execute only a specific example test by setting the `EXAMPLE` environment variable. This allows for targeted testing of a single example. ```bash # test a specific example only $ EXAMPLE=whitelist respec only examples ``` -------------------------------- ### Generate Bash Completions (User - Manual) Source: https://github.com/bashly-framework/bashly/blob/master/lib/bashly/completions/README.md If automatic installation fails, users can generate the completions script to a file and then manually copy it to their completions directory. This provides more control over the installation process. ```bash bashly completions > out.bash ``` -------------------------------- ### Example Output with Colors Source: https://github.com/bashly-framework/bashly/blob/master/examples/colors/README.md Shows the expected output of the 'colorly' application when run normally, demonstrating colored text. ```shell $ ./colorly Message Received: => hello colors ==> hello colors ===> hello colors ``` -------------------------------- ### Install Bash Completions (User - Automatic) Source: https://github.com/bashly-framework/bashly/blob/master/lib/bashly/completions/README.md Users can attempt to install bash completions automatically by running this command. Bashly will try to copy the completions script to the appropriate directory. ```bash bashly completions --install ``` -------------------------------- ### Bashly Download Command Implementation Snippet Source: https://github.com/bashly-framework/bashly/blob/master/examples/reusable-flags/README.md Example implementation file for the 'cli download' command, demonstrating access to arguments such as '--debug'. ```shell # This file is located at 'src/download_command.sh'. # It contains the implementation for the 'cli download' command. # The code you write here will be wrapped by a function named 'cli_download_command()'. # Feel free to edit this file; your changes will persist when regenerating. args: - ${args[--debug]} = 1 ``` -------------------------------- ### Execute Upload Command with Argument Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-default/README.md This example demonstrates executing the `upload` command with the required `SOURCE` argument. The implementation file `src/upload_command.sh` is generated. ```shell # This file is located at 'src/upload_command.sh'. # It contains the implementation for the 'ftp upload' command. # The code you write here will be wrapped by a function named 'ftp_upload_command()'. # Feel free to edit this file; your changes will persist when regenerating. args: - ${args[source]} = something ``` -------------------------------- ### Upload Command Error Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-examples-on-error/README.md Example output when the `upload` command is executed without the required `SOURCE` argument, and `show_examples_on_error` is enabled. It shows both single-line and multi-line example formats. ```shell $ ./cli upload missing required argument: SOURCE usage: cli upload SOURCE [OPTIONS] examples: Upload a file $ cli upload profile.png -u admin -p s3cr3t Upload a file (you will be prompted to provide a password) $ cli upload profile.png --user admin ``` -------------------------------- ### Download with Target and Force Option Source: https://github.com/bashly-framework/bashly/blob/master/spec/approvals/libraries/render/markdown/render-1-index.md An example showing how to download a file to a specific target location and overwrite it if it already exists using the force option. ```bash download example.com ./output -f ``` -------------------------------- ### Output: Help Flag Source: https://github.com/bashly-framework/bashly/blob/master/examples/custom-strings/README.md Example output when the help flag (-h) is used, showing custom usage and options. ```shell $ ./download -h download - Sample minimal application with custom strings == Usage == download SOURCE [OPTIONS] download --help | -h download --version | -v == Options == --out, -o DIR (required) Target directory --help, -h Show this helpful help --version, -v Show version number == Arguments == SOURCE URL to download from ``` -------------------------------- ### Set Command Example Output (`$ ./configly set user.password s3cr3t`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/config/README.md Demonstrates setting a new configuration key 'user.password' to 's3cr3t' and displays the updated configuration. ```shell theme = dark user.email = paul@section.one user.name = Operations user.password = s3cr3t ``` -------------------------------- ### CLI Download Command Help Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/colors-usage/README.md Shows the help message for the `download` command, detailing its usage, options, arguments, environment variables, and examples. ```shell $ ./cli download -h cli download - Download a file Alias: d Usage: cli download SOURCE [TARGET] [OPTIONS] cli download --help | -h Options: --force, -f Overwrite existing files --help, -h Show this help Arguments: SOURCE URL to download from TARGET Target filename (default: same as source) Environment Variables: DEFAULT_TARGET_LOCATION Set the default location to download to Examples: cli download example.com cli download example.com ./output -f ``` -------------------------------- ### Bashly Configuration Example Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-line-manipulation/README.md This YAML configuration defines a minimal Bashly application named 'download' with one required argument 'source' and an optional 'target', along with a '--force' flag. ```yaml name: download help: Sample minimal application without commands version: 0.1.0 args: - name: source required: true help: URL to download from - name: target help: "Target filename (default: same as source)" flags: - long: --force short: -f help: Overwrite existing files ``` -------------------------------- ### Bashly CLI: Set Command Example Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/ini/README.md Shows the output after setting a key-value pair using the 'set' command, demonstrating the updated INI content. ```shell bashly = works hello = WORLD [options] name = value for options.name path = value for options.path [user] email = value for user.email name = value for user.name ``` -------------------------------- ### Successful Deploy Command Execution Source: https://github.com/bashly-framework/bashly/blob/master/examples/validations/README.md Example of a successful execution of the 'deploy' command with a valid username provided for the --user flag. ```shell $ ./validate deploy --user admin # This file is located at 'src/deploy_command.sh'. # It contains the implementation for the 'validate deploy' command. # The code you write here will be wrapped by a function named 'validate_deploy_command()'. # Feel free to edit this file; your changes will persist when regenerating. args: - ${args[--user]} = admin ``` -------------------------------- ### Download Command Error Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-examples-on-error/README.md Example output when the `download` command is executed without the required `SOURCE` argument, and `show_examples_on_error` is enabled. ```shell $ ./cli download missing required argument: SOURCE usage: cli download SOURCE [TARGET] [OPTIONS] examples: cli download example.com cli download example.com ./output -f ``` -------------------------------- ### CLI Execution with File Arguments and CSV Format Source: https://github.com/bashly-framework/bashly/blob/master/examples/catch-all-stdin/README.md Example of running the CLI with two file arguments and specifying the CSV format. Shows how arguments are parsed and file contents are collected. ```shell args: - ${args[--format]} = csv other_args: - ${other_args[*]} = file1 file2 - ${other_args[0]} = file1 - ${other_args[1]} = file2 collected file contents: file1 content file2 content ``` -------------------------------- ### Bashly CLI: Get Nested Key Example Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/ini/README.md Shows the output of the 'get' command when retrieving a nested key ('user.name'). ```shell user.name = value for user.name ``` -------------------------------- ### Bashly Application Help Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/minimal/README.md Displays the help message for the generated Bashly application, including usage, options, arguments, and examples. ```shell download - Sample minimal application without commands Usage: download SOURCE [TARGET] [OPTIONS] download --help | -h download --version | -v Options: --force, -f Overwrite existing files --help, -h Show this help --version, -v Show version number Arguments: SOURCE URL to download from TARGET Target filename (default: same as source) Examples: download example.com download example.com ./output -f ``` -------------------------------- ### Bashly Upload Command Implementation Snippet Source: https://github.com/bashly-framework/bashly/blob/master/examples/reusable-flags/README.md Example implementation file for the 'cli upload' command, showing how to access command arguments like '--force'. ```shell # This file is located at 'src/upload_command.sh'. # It contains the implementation for the 'cli upload' command. # The code you write here will be wrapped by a function named 'cli_upload_command()'. # Feel free to edit this file; your changes will persist when regenerating. args: - ${args[--force]} = 1 ``` -------------------------------- ### Download Command Help Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-examples/README.md Displays the help information for the 'download' command, including its usage, options, arguments, and defined examples. This output is generated by bashly based on the src/bashly.yml configuration. ```shell cli download - Download a file Alias: d Usage: cli download SOURCE [TARGET] [OPTIONS] cli download --help | -h Options: --force, -f Overwrite existing files --help, -h Show this help Arguments: SOURCE URL to download from TARGET Target filename (default: same as source) Examples: cli download example.com cli download example.com ./output -f ``` -------------------------------- ### Example Output for Compress Command Source: https://github.com/bashly-framework/bashly/blob/master/examples/variables/README.md Shows the expected output when running the 'compress' command. Variables, including associative arrays, are correctly substituted. ```shell build_number: 1337 zip_options: compression_level: fast pattern: "*.json" environments: - dev - stage - production ``` -------------------------------- ### Initialize Bashly and Add Help Command Source: https://github.com/bashly-framework/bashly/blob/master/examples/help-command/README.md Steps to initialize a new Bashly project and add the help command functionality. ```bash $ bashly init $ bashly add help # ... now edit src/bashly.yml to match the example ... $ bashly generate ``` -------------------------------- ### Bashly CLI: List Command Example Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/ini/README.md Shows the output of the 'list' command, displaying all key-value pairs from the INI file in a flattened format. ```shell bashly = works hello = world options.name = value for options.name options.path = value for options.path user.email = value for user.email user.name = value for user.name ``` -------------------------------- ### Bashly Generated Help Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/catch-all-stdin/README.md Displays the help message for the CLI application, including usage, options, arguments, and examples. Shows how the catch-all argument and flags are presented. ```shell cli - Sample application Usage: cli [OPTIONS] [--] [FILE...] cli --help | -h cli --version | -v Options: --format, -f FORMAT Specify file format Allowed: csv, json Default: json --help, -h Show this help --version, -v Show version number Arguments: FILE... Path to one or more files. Reads from stdin if empty or "-". Examples: cli file1 file2 --format csv cli --format csv file1 file2 cat file1 | cli --format csv cat file* | cli - --format csv ``` -------------------------------- ### Bash Argument Expansion Example Source: https://github.com/bashly-framework/bashly/blob/master/examples/catch-all-advanced/README.md Demonstrates how to expand bash arrays into individual arguments or access specific elements. Useful for passing lists of files or options to commands. ```bash args: none other_args: - ${other_args[*]} = file1 file 2 file3 - ${other_args[0]} = file1 - ${other_args[1]} = file 2 - ${other_args[2]} = file3 ``` -------------------------------- ### Execute Download Application with --cache flag Source: https://github.com/bashly-framework/bashly/blob/master/examples/conflicts/README.md Executes the 'download' application with the --cache flag enabled. This example shows the expected output when a valid flag is used. ```shell $ ./download --cache # this file is located in 'src/root_command.sh' # you can edit it freely and regenerate (it will not be overwritten) args: - ${args[--cache]} = 1 ``` -------------------------------- ### Bashly CLI: Get Invalid Key Example Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/ini/README.md Demonstrates the output when attempting to retrieve a non-existent key, showing the 'No such key' message. ```shell No such key: invalid_key ``` -------------------------------- ### Initialize and Generate Bashly Project Source: https://github.com/bashly-framework/bashly/blob/master/examples/multiple-lib-dirs/README.md Commands to initialize a minimal Bashly project, add a command, and generate the script. Edit `settings.yml` and `src/root_command.sh` as per the example. ```bash $ bashly init --minimal $ bashly add settings # ... now edit settings.yml to match the example ... $ bashly generate # ... now edit src/root_command.sh to match the example ... $ bashly generate ``` -------------------------------- ### Bashly Configuration with Hooks Source: https://github.com/bashly-framework/bashly/blob/master/examples/hooks/README.md Defines the application name, help text, version, and flags in the `bashly.yml` configuration file. This setup is necessary for the before/after hooks to function. ```yaml name: hooks help: Sample application that uses before/after hooks version: 0.1.0 flags: - long: --debug short: -d help: Enable debug mode ``` -------------------------------- ### Run Only Example Tests with respec Source: https://github.com/bashly-framework/bashly/blob/master/spec/README.md Execute only the example tests. This command is useful for focusing on the behavior of generated examples. ```bash # test examples only $ respec only examples ``` -------------------------------- ### Flag with Argument Starting with Dash Source: https://github.com/bashly-framework/bashly/blob/master/spec/fixtures/workspaces/flag-args-with-dash/README.md Use this syntax when a flag's argument is expected to start with a dash. This ensures the argument is parsed correctly. ```bash --options '--verbose -v' ``` -------------------------------- ### CLI Help Output with Default Command Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-default/README.md When a default command is set, it is indicated in the CLI help output. This example shows the general help message for the `ftp` application. ```shell ftp - Sample application that uses the default command option Usage: ftp COMMAND ftp [COMMAND] --help | -h ftp --version | -v Commands: upload Upload a file (default) download Download a file ``` -------------------------------- ### Initialize Bashly Project Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-filenames/README.md Use `bashly init` to create a new project. Then, edit `bashly.yml` to configure custom command filenames. ```bash $ bashly init # ... now edit src/bashly.yml to match the example ... $ bashly generate ``` -------------------------------- ### Initialize Bashly Project Source: https://github.com/bashly-framework/bashly/blob/master/examples/custom-strings/README.md Initializes a minimal bashly project and adds the strings configuration. ```bash $ bashly init --minimal $ bashly add strings $ bashly generate ``` -------------------------------- ### Bashly CLI: Get Command Implementation Source: https://github.com/bashly-framework/bashly/blob/master/examples/ini/README.md Implements the 'get' command to read a specific value from the INI configuration file using the `ini_load` and array access. Handles cases where the key does not exist. ```bash # Using the standard library (lib/ini.sh) to show a value from the config ini_load config.ini key="${args[key]:-}" value=${ini[$key]:-} if [[ "$value" ]]; then echo "$key = $value" else echo "No such key: $key" fi ``` -------------------------------- ### Upload Command Help Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-examples/README.md Shows the help output for the 'upload' command, detailing its usage, required options like username, optional password, and the examples provided in the configuration. This output is generated by bashly. ```shell cli upload - Upload a file Alias: u Usage: cli upload SOURCE [OPTIONS] cli upload --help | -h Options: --user, -u USER (required) Username to use for logging in --password, -p PASSWORD Password to use for logging in --help, -h Show this help Arguments: SOURCE File to upload Examples: Upload a file $ cli upload profile.png -u admin -p s3cr3t Upload a file (you will be prompted to provide a password) $ cli upload profile.png --user admin ``` -------------------------------- ### Bash Completion Function Source: https://github.com/bashly-framework/bashly/blob/master/examples/completions/README.md This function filters words for command completion, excluding options that start with a hyphen unless the current word also starts with a hyphen. It's used internally by the main completion logic. ```bash _cli_completions_filter() { local words="$1" local cur=${COMP_WORDS[COMP_CWORD]} local result=() if [[ "${cur:0:1}" == "-" ]]; then echo "$words" else for word in $words; do [[ "${word:0:1}" != "-" ]] && result+=("$word") done echo "${result[*]}" fi } ``` -------------------------------- ### Initialize Bashly Project Source: https://github.com/bashly-framework/bashly/blob/master/examples/custom-includes/README.md Commands to initialize a new Bashly project and prepare it for custom includes. ```bash $ bashly init # ... now edit src/bashly.yml to match the example ... $ bashly add lib $ bashly generate # ... now edit src/root_command.sh ... $ bashly generate ``` -------------------------------- ### Bashly CLI Output with File Input Source: https://github.com/bashly-framework/bashly/blob/master/examples/stdin/README.md Example output when the CLI is invoked with a file path as an argument. ```shell args: - ${args[--file]} = - - ${args[path]} = some-file some file with some content ``` -------------------------------- ### Initialize Bashly Project Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-default-force/README.md Use `bashly init` to create a new Bashly project. This command sets up the basic directory structure and configuration files. ```bash bashly init ``` -------------------------------- ### Bashly Command Implementation: Basic Argument Source: https://github.com/bashly-framework/bashly/blob/master/examples/catch-all/README.md Example of how a basic argument is captured and processed when `catch_all` is enabled. ```shell # This file is located at 'src/root_command.sh'. # It contains the implementation for the 'download' command. # The code you write here will be wrapped by a function named 'download_command()'. # Feel free to edit this file; your changes will persist when regenerating. args: - ${args[message]} = something ``` -------------------------------- ### CLI Help with Options Source: https://github.com/bashly-framework/bashly/blob/master/examples/completions/README.md Shows the help message including global options like --help and --version. ```shell $ ./cli -h cli - Sample application with bash completions Usage: cli COMMAND cli [COMMAND] --help | -h cli --version | -v Commands: completions Generate bash completions download Download a file upload Upload a file Options: --help, -h Show this help --version, -v Show version number ``` -------------------------------- ### Bashly Command Output: Missing Argument Source: https://github.com/bashly-framework/bashly/blob/master/examples/catch-all/README.md Example output when the required argument is missing for the generated command. ```shell missing required argument: MESSAGE usage: download MESSAGE [OPTIONS] [--] [...] ``` -------------------------------- ### Root Command Script (`src/root_command.sh`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/multiple-lib-dirs/README.md Example bash script that calls functions defined in the extra library directories. ```bash # Calling library functions common_function cloud_function ``` -------------------------------- ### Output: Missing Required Flag Source: https://github.com/bashly-framework/bashly/blob/master/examples/custom-strings/README.md Example output when a required flag is missing, demonstrating custom error messages. ```shell $ ./download somesource Yo! you forgot a flag: --out, -o DIR ``` -------------------------------- ### Initialize and Render Bashly Markdown Source: https://github.com/bashly-framework/bashly/blob/master/examples/render-markdown/README.md Initialize a new bashly project and then render the markdown documentation. Ensure your `bashly.yml` is configured to include custom markdown properties. ```bash $ bashly init --minimal # ... now edit src/bashly.yml to match the example ... $ bashly render :markdown docs ``` -------------------------------- ### Initialize Bashly Project and Add Colors Source: https://github.com/bashly-framework/bashly/blob/master/examples/colors-usage/README.md Commands to set up a new Bashly project and include the standard colors library. Ensure `settings.yml` is edited to define color mappings. ```bash $ bashly init $ bashly add colors $ bashly add settings # ... now edit settings.yml to match the example ... $ bashly generate ``` -------------------------------- ### Output: Missing Required Argument Source: https://github.com/bashly-framework/bashly/blob/master/examples/custom-strings/README.md Example output when a required argument is missing, demonstrating custom error messages. ```shell $ ./download Boom! a required argument is missing: SOURCE usage: download SOURCE [OPTIONS] ``` -------------------------------- ### Bashly Configuration (`bashly.yml`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/custom-script-header/README.md Defines the application name, version, arguments, flags, and examples for the Bashly CLI application. ```yaml name: download help: Sample minimal application without commands version: 0.1.0 args: - name: source required: true help: URL to download from - name: target help: "Target filename (default: same as source)" flags: - long: --force short: -f help: Overwrite existing files examples: - download example.com - download example.com ./output -f ``` -------------------------------- ### Example Output without Colors Source: https://github.com/bashly-framework/bashly/blob/master/examples/colors/README.md Demonstrates the output when the NO_COLOR environment variable is set, disabling colored text. ```shell $ NO_COLOR=1 ./colorly Message Received: => hello colors ==> hello colors ===> hello colors ``` -------------------------------- ### Initialize Bashly Project Source: https://github.com/bashly-framework/bashly/blob/master/examples/hooks/README.md Steps to initialize a new Bashly project and add the hooks functionality. ```bash $ bashly init # ... now edit src/bashly.yml to match the example ... $ bashly add hooks $ bashly generate ``` -------------------------------- ### Download Command Help Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/catch-all-advanced/README.md Shows the detailed help message for the `download` command, including its arguments, options, and the `catch_all` parameters. ```shell cli download - Download a file Alias: d Usage: cli download SOURCE [TARGET] [OPTIONS] [--] [AWS PARAMS...] cli download --help | -h Options: --force, -f Overwrite existing files --help, -h Show this help Arguments: SOURCE URL to download from TARGET Target filename (default: same as source) AWS PARAMS... Additional arguments or flags for AWS CLI Examples: cli download example.com cli download example.com ./output -f ``` -------------------------------- ### Docker Container Command Usage Source: https://github.com/bashly-framework/bashly/blob/master/spec/approvals/rendering/markdown/docker-like/docker container.md This is the general usage pattern for Docker container commands. Ensure Docker is installed and running. ```bash docker container COMMAND ``` -------------------------------- ### Output for Missing Dependencies (upload command) Source: https://github.com/bashly-framework/bashly/blob/master/examples/dependencies/README.md For the 'upload' command, missing dependencies are listed along with their custom installation messages. ```shell missing dependency: mini-docker install with gem install mini-docker missing dependency: multi-docker install with gem install multi-docker ``` -------------------------------- ### Execute Deploy Command with Build and Test Flags Source: https://github.com/bashly-framework/bashly/blob/master/examples/internal-run/README.md Demonstrates the output when the 'deploy' command is executed with both the `--build` and `--test` flags, showing the execution of dependent commands and the final deployment message. ```shell $ ./cli deploy --build --test ``` -------------------------------- ### Bashly Initialization and Generation Source: https://github.com/bashly-framework/bashly/blob/master/examples/catch-all/README.md Steps to initialize a new Bashly project and generate the command-line interface. ```bash bashly init ``` ```bash bashly generate ``` -------------------------------- ### Successful Build Command Execution Source: https://github.com/bashly-framework/bashly/blob/master/examples/validations/README.md Example of a successful execution of the 'build' command when the BUILD_DIR environment variable is set to an existing directory. ```shell $ BUILD_DIR=src ./validate build ``` -------------------------------- ### Initialize Bashly Project Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-paths/README.md Initializes a new bashly project. This is the first step before adding commands or configuring settings. ```bash $ bashly init ``` -------------------------------- ### Bashly CLI: Del Command Example Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/ini/README.md Displays the INI content after a key ('user.email') has been deleted using the 'del' command. ```shell bashly = works hello = world [options] name = value for options.name path = value for options.path [user] name = value for user.name ``` -------------------------------- ### Bashly Download Command Help Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/reusable-flags/README.md Shows the help information for the 'download' command, including its specific options like '--force' and '--debug'. ```shell $ ./cli download -h cli download - Download a file Usage: cli download [OPTIONS] cli download --help | -h Options: --force, -f Overwrite existing files --debug, -d Show debug information --help, -h Show this help ``` -------------------------------- ### Execute Container Command with Filter Source: https://github.com/bashly-framework/bashly/blob/master/examples/filters/README.md Example output when running the 'container' command. If Docker is not running, the 'filter_docker_running' would have halted execution. ```shell # this file is located in 'src/container_command.sh' # code for 'cli container' goes here # you can edit it freely and regenerate (it will not be overwritten) args: - ${args[id]} = sample-id ``` -------------------------------- ### Display CLI Help with Options Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-filenames/README.md Use the `-h` flag to show detailed help, including available commands and global options like `--help` and `--version`. ```shell $ ./cli -h cli - Demonstrate custom command filenames Usage: cli COMMAND cli [COMMAND] --help | -h cli --version | -v Commands: dir Directory commands file File commands Options: --help, -h Show this help --version, -v Show version number ``` -------------------------------- ### Output: Flag Requires Argument Source: https://github.com/bashly-framework/bashly/blob/master/examples/custom-strings/README.md Example output when a flag requires an argument but none is provided, showing custom error messages. ```shell $ ./download somesource -o Hey! the flag --out requires an argument: --out, -o DIR ``` -------------------------------- ### Display Help for Deprecated Command Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-function/README.md Displays the help information for the `container-start` command, including its footer message indicating deprecation. ```shell $ ./cli container-start --help cli container-start - Start a new container (deprecated) Usage: cli container-start cli container-start --help | -h Options: --help, -h Show this help This command is deprecated, use 'container start' instead ``` -------------------------------- ### Download Command Implementation - All Arguments and Other Args Source: https://github.com/bashly-framework/bashly/blob/master/examples/catch-all-advanced/README.md Illustrates how all standard arguments, flags, and any additional arguments passed to `catch_all` (like `-abc --option=value`) are accessed within the `cli_download_command` function. ```bash # This file is located at 'src/download_command.sh'. # It contains the implementation for the 'cli download' command. # The code you write here will be wrapped by a function named 'cli_download_command()'. # Feel free to edit this file; your changes will persist when regenerating. args: - ${args[--force]} = 1 - ${args[source]} = source - ${args[target]} = target other_args: - ${other_args[*]} = -a -b -c --option value - ${other_args[0]} = -a - ${other_args[1]} = -b - ${other_args[2]} = -c - ${other_args[3]} = --option - ${other_args[4]} = value ``` -------------------------------- ### Bashly Generated Help Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/yaml/README.md The help message generated by Bashly for the YAML processing application. It details the usage, options, arguments, and examples. ```shell yaml - Sample application that uses the YAML functions Usage: yaml FILENAME [VARIABLE] [OPTIONS] yaml --help | -h yaml --version | -v Options: --prefix, -p PREFIX --help, -h Show this help --version, -v Show version number Arguments: FILENAME The YAML file to read VARIABLE Show only this variable Examples: yaml settings.yml yaml settings.yml --prefix config_ yaml settings.yml server_port ``` -------------------------------- ### List Command Implementation (`src/list_command.sh`) Source: https://github.com/bashly-framework/bashly/blob/master/examples/config/README.md Implements the 'list' command to display all configuration values. Shows how to display the entire config or iterate through keys. ```bash # Using the standard library (lib/config.sh) to show the entire config file config_show # Or to iterate through keys for key in $(config_keys); do echo "$key === $(config_get "$key")" done ``` -------------------------------- ### Execute Download Command via Alias Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-aliases/README.md Shows the execution of the 'download' command using its alias 'd', demonstrating how arguments are passed. ```shell # This file is located at 'src/download_command.sh'. # It contains the implementation for the 'cli download' command. # The code you write here will be wrapped by a function named 'cli_download_command()'. # Feel free to edit this file; your changes will persist when regenerating. args: - ${args[source]} = somefile environment variables: - $API_KEY = ``` -------------------------------- ### Download Command Usage Source: https://github.com/bashly-framework/bashly/blob/master/spec/approvals/libraries/render/markdown/render-1-index.md Shows the general syntax for the download command. Use this to understand the expected arguments and options. ```bash download SOURCE [TARGET] [OPTIONS] ``` -------------------------------- ### Bashly CLI: Set User Name Example Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/ini/README.md Demonstrates setting a nested key ('user.name') and displays the resulting INI content. ```shell bashly = works hello = world [options] name = value for options.name path = value for options.path [user] email = value for user.email name = Megatron ``` -------------------------------- ### Help Output for Repeatable Argument Command Source: https://github.com/bashly-framework/bashly/blob/master/examples/repeatable-arg/README.md This is the help message generated for the command configured with a repeatable argument. It shows the usage, options, and examples. ```shell upcase - Sample application to demonstrate the use of repeatable arguments Usage: upcase [FILE...] upcase --help | -h upcase --version | -v Options: --help, -h Show this help --version, -v Show version number Arguments: FILE... One or more files to process Default: file1, file2 Examples: upcase README.md LICENSE upcase *.md ``` -------------------------------- ### Display Help for Download Application Source: https://github.com/bashly-framework/bashly/blob/master/examples/conflicts/README.md Shows the help message for the generated 'download' application, including the defined flags and their conflicts. ```shell $ ./download -h download - Sample application to demonstrate the use of conflicting flags Usage: download [OPTIONS] download --help | -h download --version | -v Options: --cache Enable cache Conflicts: --no-cache --no-cache Disable cache Conflicts: --cache, --fast --fast Run faster Conflicts: --no-cache --help, -h Show this help --version, -v Show version number ``` -------------------------------- ### Bashly Initialization and Generation Source: https://github.com/bashly-framework/bashly/blob/master/examples/private-reveal/README.md Commands to initialize a new Bashly project, add a 'settings' component, and generate the CLI. ```bash $ bashly init $ bashly add settings # ... now edit settings.yml to match the example ... # ... now edit src/bashly.yml to match the example ... $ bashly generate ``` -------------------------------- ### Execute Upload Command - Missing Argument Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-default/README.md This example shows the error message when the `upload` command is executed without its required `SOURCE` argument. ```shell missing required argument: SOURCE usage: ftp [upload] SOURCE ``` -------------------------------- ### Bashly Download Command Help Source: https://github.com/bashly-framework/bashly/blob/master/examples/commands/README.md Displays the help message for the 'download' sub-command, including its usage, options, arguments, and environment variables. ```shell cli download - Download a file Alias: d Usage: cli download SOURCE [TARGET] [OPTIONS] cli download --help | -h Options: --force, -f Overwrite existing files --help, -h Show this help Arguments: SOURCE URL to download from TARGET Target filename (default: same as source) Environment Variables: DEFAULT_TARGET_LOCATION Set the default location to download to Examples: cli download example.com cli download example.com ./output -f ``` -------------------------------- ### Initialize Bashly Project Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-examples/README.md Use this command to initialize a new bashly project. After initialization, edit src/bashly.yml to define your commands and their configurations. ```bash bashly init ``` ```bash # ... now edit src/bashly.yml to match the example ... ``` ```bash bashly generate ``` -------------------------------- ### Display Main CLI Help with Options Source: https://github.com/bashly-framework/bashly/blob/master/examples/commands-nested/README.md Displays the help message for the 'cli' application, including general options like --help and --version. ```shell cli - Sample application with nested commands Usage: cli COMMAND cli [COMMAND] --help | -h cli --version | -v Commands: dir Directory commands file File commands Options: --help, -h Show this help --version, -v Show version number ``` -------------------------------- ### Bashly CLI Output with STDIN Input via Pipe Source: https://github.com/bashly-framework/bashly/blob/master/examples/stdin/README.md Example output when the CLI is invoked with STDIN piped to it, and the path argument defaults to '-'. ```shell args: - ${args[--file]} = - - ${args[path]} = - some file with some content ``` -------------------------------- ### Display Main CLI Help Source: https://github.com/bashly-framework/bashly/blob/master/examples/command-filenames/README.md Run the main command without arguments to display the top-level help message, listing available commands. ```shell $ ./cli cli - Demonstrate custom command filenames Usage: cli COMMAND cli [COMMAND] --help | -h cli --version | -v Commands: dir Directory commands file File commands ``` -------------------------------- ### Download Command Help Output Source: https://github.com/bashly-framework/bashly/blob/master/examples/split-config/README.md The help output for the 'download' command, detailing its usage, options, and arguments. ```shell cli download - Download a file Alias: d Usage: cli download SOURCE [TARGET] [OPTIONS] cli download --help | -h Options: --force, -f Overwrite existing files --help, -h Show this help Arguments: SOURCE URL to download from TARGET Target filename (default: same as source) ```