|
| 1 | +# Help Header Override Example |
| 2 | + |
| 3 | +Demonstrates how to fully replace the header in the output of `--help`. |
| 4 | + |
| 5 | +This is especially useful when incorporating ASCII art as your script's help |
| 6 | +header. |
| 7 | + |
| 8 | +This example was generated with: |
| 9 | + |
| 10 | +```bash |
| 11 | +$ bashly init --minimal |
| 12 | +# ... now edit src/bashly.yml to match the example ... |
| 13 | +$ bashly generate |
| 14 | + |
| 15 | +``` |
| 16 | + |
| 17 | +----- |
| 18 | + |
| 19 | +## `bashly.yml` |
| 20 | + |
| 21 | +````yaml |
| 22 | +name: download |
| 23 | +help: Sample minimal application without commands |
| 24 | +version: 0.1.0 |
| 25 | + |
| 26 | +# Use bash code here directly or a function name that references code elsewhere. |
| 27 | +help_header_override: | |
| 28 | + echo |
| 29 | + echo $' 888888b. 888 888 ' |
| 30 | + echo $' 888 "88b 888 888 ' |
| 31 | + echo $' 888 .88P 888 888 ' |
| 32 | + echo $' 8888888K. 8888b. .d8888b 88888b. 888 888 888 ' |
| 33 | + echo $' 888 "Y88b "88b 88K 888 "88b 888 888 888 ' |
| 34 | + echo $' 888 888 .d888888 "Y8888b. 888 888 888 888 888 ' |
| 35 | + echo $' 888 d88P 888 888 X88 888 888 888 Y88b 888 ' |
| 36 | + echo $' 8888888P" "Y888888 88888P\' 888 888 888 "Y88888 ' |
| 37 | + echo $' 888 ' |
| 38 | + echo $' Y8b d88P ' |
| 39 | + echo $' "Y88P" ' |
| 40 | + echo |
| 41 | +
|
| 42 | +args: |
| 43 | +- name: source |
| 44 | + help: URL to download from |
| 45 | +- name: target |
| 46 | + help: "Target filename (default: same as source)" |
| 47 | + |
| 48 | +flags: |
| 49 | +- long: --force |
| 50 | + short: -f |
| 51 | + help: Overwrite existing files |
| 52 | + |
| 53 | +examples: |
| 54 | +- download example.com |
| 55 | +- download example.com ./output -f |
| 56 | +```` |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +## Output |
| 61 | + |
| 62 | +### `$ ./download` |
| 63 | + |
| 64 | +````shell |
| 65 | +# This file is located at 'src/root_command.sh'. |
| 66 | +# It contains the implementation for the 'download' command. |
| 67 | +# The code you write here will be wrapped by a function named 'download_command()'. |
| 68 | +# Feel free to edit this file; your changes will persist when regenerating. |
| 69 | +args: none |
| 70 | + |
| 71 | + |
| 72 | +```` |
| 73 | + |
| 74 | +### `$ ./download --help` |
| 75 | + |
| 76 | +````shell |
| 77 | + |
| 78 | + 888888b. 888 888 |
| 79 | + 888 "88b 888 888 |
| 80 | + 888 .88P 888 888 |
| 81 | + 8888888K. 8888b. .d8888b 88888b. 888 888 888 |
| 82 | + 888 "Y88b "88b 88K 888 "88b 888 888 888 |
| 83 | + 888 888 .d888888 "Y8888b. 888 888 888 888 888 |
| 84 | + 888 d88P 888 888 X88 888 888 888 Y88b 888 |
| 85 | + 8888888P" "Y888888 88888P' 888 888 888 "Y88888 |
| 86 | + 888 |
| 87 | + Y8b d88P |
| 88 | + "Y88P" |
| 89 | + |
| 90 | +Usage: |
| 91 | + download [SOURCE] [TARGET] [OPTIONS] |
| 92 | + download --help | -h |
| 93 | + download --version | -v |
| 94 | + |
| 95 | +Options: |
| 96 | + --force, -f |
| 97 | + Overwrite existing files |
| 98 | + |
| 99 | + --help, -h |
| 100 | + Show this help |
| 101 | + |
| 102 | + --version, -v |
| 103 | + Show version number |
| 104 | + |
| 105 | +Arguments: |
| 106 | + SOURCE |
| 107 | + URL to download from |
| 108 | + |
| 109 | + TARGET |
| 110 | + Target filename (default: same as source) |
| 111 | + |
| 112 | +Examples: |
| 113 | + download example.com |
| 114 | + download example.com ./output -f |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | +```` |
| 119 | + |
| 120 | + |
| 121 | + |
0 commit comments