Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ help: a sample script generated with bashly
version: 0.1.0

# Specify an array of examples to show when using --help
# Each example can have multiple lines.
examples:
- myscript download
- myscript download --force

# Specify an array of environment variables needed by your script
# This is used purely for displaying in the help text (when using --help)
# The help for each variable can have multiple lines.
environment_variable:
VARIABLE_NAME: Variable help text

Expand Down Expand Up @@ -185,8 +187,7 @@ bash function.
name: user

# The message to display when using --help.
# This can have multiple lines, but it is recommended to keep lines shorter
# than ~70 characters, to avoid text wrapping in narrower terminals.
# This can have multiple lines.
help: Username to use for logging in

# Specify if this argument is required.
Expand Down Expand Up @@ -216,8 +217,7 @@ long: --output
short: -o

# The text to display when using --help
# This can have multiple lines, but it is recommended to keep lines shorter
# than ~70 characters, to avoid text wrapping in narrower terminals.
# This can have multiple lines.
help: Specify the output directory

# If the flag requires an argument, specify its name here.
Expand Down
1 change: 1 addition & 0 deletions Runfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def examples
"examples/custom-strings/download",
"examples/minimal/download",
"examples/subcommands/cli",
"examples/multiline/multi",
"spec/fixtures/workspaces/short-flag/rush",
]
end
Expand Down
11 changes: 8 additions & 3 deletions examples/colors/colorly
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ version_command() {

# :command.usage
colorly_usage() {
echo -e "colorly - Sample application that uses the color functions"
echo
if [[ -n $long_usage ]]; then
echo -e "colorly - Sample application that uses the color functions"
echo
else
echo -e "colorly - Sample application that uses the color functions"
echo
fi
echo -e "Usage:"
echo -e " colorly [MESSAGE] [options]"
echo
Expand All @@ -44,7 +49,7 @@ colorly_usage() {

# :argument.usage
echo " MESSAGE"
echo " Message to show [default: hello colors]"
echo -e " Message to show [default: hello colors]"
echo


Expand Down
48 changes: 35 additions & 13 deletions examples/config-ini/configly
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ version_command() {

# :command.usage
configly_usage() {
echo -e "configly - Sample application that uses the config functions"
echo
if [[ -n $long_usage ]]; then
echo -e "configly - Sample application that uses the config functions"
echo
else
echo -e "configly - Sample application that uses the config functions"
echo
fi
echo -e "Usage:"
echo -e " configly [command] [options]"
echo
Expand Down Expand Up @@ -41,8 +46,13 @@ configly_usage() {

# :command.usage
configly_set_usage() {
echo -e "configly set - Save a value in the config file"
echo
if [[ -n $long_usage ]]; then
echo -e "configly set - Save a value in the config file"
echo
else
echo -e "configly set - Save a value in the config file"
echo
fi
echo -e "Usage:"
echo -e " configly set KEY VALUE [options]"
echo
Expand All @@ -63,17 +73,18 @@ configly_set_usage() {

# :argument.usage
echo " KEY"
echo " Config key"
echo -e " Config key"
echo

# :argument.usage
echo " VALUE"
echo " Config value"
echo -e " Config value"
echo

# :command.usage_examples
echo -e "Examples:"
echo " configly set hello world"

echo -e " configly set hello world"
echo

fi
Expand All @@ -82,8 +93,13 @@ configly_set_usage() {

# :command.usage
configly_get_usage() {
echo -e "configly get - Read a value from the config file"
echo
if [[ -n $long_usage ]]; then
echo -e "configly get - Read a value from the config file"
echo
else
echo -e "configly get - Read a value from the config file"
echo
fi
echo -e "Usage:"
echo -e " configly get KEY [options]"
echo
Expand All @@ -104,12 +120,13 @@ configly_get_usage() {

# :argument.usage
echo " KEY"
echo " Config key"
echo -e " Config key"
echo

# :command.usage_examples
echo -e "Examples:"
echo " configly set hello"

echo -e " configly set hello"
echo

fi
Expand All @@ -118,8 +135,13 @@ configly_get_usage() {

# :command.usage
configly_list_usage() {
echo -e "configly list - Show the entire config file"
echo
if [[ -n $long_usage ]]; then
echo -e "configly list - Show the entire config file"
echo
else
echo -e "configly list - Show the entire config file"
echo
fi
echo -e "Usage:"
echo -e " configly list [options]"
echo
Expand Down
11 changes: 8 additions & 3 deletions examples/custom-includes/download
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ version_command() {

# :command.usage
download_usage() {
echo -e "download - Sample minimal application with custom strings"
echo
if [[ -n $long_usage ]]; then
echo -e "download - Sample minimal application with custom strings"
echo
else
echo -e "download - Sample minimal application with custom strings"
echo
fi
echo -e "Usage:"
echo -e " download [SOURCE] [options]"
echo
Expand All @@ -40,7 +45,7 @@ download_usage() {

# :argument.usage
echo " SOURCE"
echo " URL to download from"
echo -e " URL to download from"
echo


Expand Down
13 changes: 9 additions & 4 deletions examples/custom-strings/download
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ version_command() {

# :command.usage
download_usage() {
echo -e "download - Sample minimal application with custom strings"
echo
if [[ -n $long_usage ]]; then
echo -e "download - Sample minimal application with custom strings"
echo
else
echo -e "download - Sample minimal application with custom strings"
echo
fi
echo -e "== Usage ==
"
echo -e " download SOURCE [options]"
Expand All @@ -38,15 +43,15 @@ download_usage() {
# :command.usage_flags
# :flag.usage
echo " --out, -o DIR (required)"
echo " Target directory"
echo -e " Target directory"
echo
# :command.usage_args
echo -e "== Arguments ==
"

# :argument.usage
echo " SOURCE"
echo " URL to download from"
echo -e " URL to download from"
echo


Expand Down
20 changes: 13 additions & 7 deletions examples/minimal/download
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ version_command() {

# :command.usage
download_usage() {
echo -e "download - Sample minimal application without subcommands"
echo
if [[ -n $long_usage ]]; then
echo -e "download - Sample minimal application without subcommands"
echo
else
echo -e "download - Sample minimal application without subcommands"
echo
fi
echo -e "Usage:"
echo -e " download SOURCE [TARGET] [options]"
echo
Expand All @@ -36,25 +41,26 @@ download_usage() {
# :command.usage_flags
# :flag.usage
echo " --force, -f"
echo " Overwrite existing files"
echo -e " Overwrite existing files"
echo
# :command.usage_args
echo -e "Arguments:"

# :argument.usage
echo " SOURCE"
echo " URL to download from"
echo -e " URL to download from"
echo

# :argument.usage
echo " TARGET"
echo " Target filename (default: same as source)"
echo -e " Target filename (default: same as source)"
echo

# :command.usage_examples
echo -e "Examples:"
echo " download example.com"
echo " download example.com ./output -f"

echo -e " download example.com"
echo -e " download example.com ./output -f"
echo

fi
Expand Down
6 changes: 6 additions & 0 deletions examples/multiline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Multiline Example
==================================================

This example was generated manually to demonstrate multiline usage text.

$ bashly generate
Loading