Demonstrates how to set a command as the default command. This command can be executed without explicitly specifying the command name.
This example was generated with:
$ bashly init
# ... now edit src/bashly.yml to match the example ...
$ bashly generate
name: ftp
help: Sample application that uses the default command option
version: 0.1.0
commands:
- name: upload
alias: u
help: Upload a file
# By setting the `upload` command as the default command, it will be executed
# when the command line is not recognized.
# Running `ftp upload something` is the same as `ftp something`
default: true
args:
- name: source
required: true
help: File to upload
- name: download
alias: d
help: Download a file
args:
- name: source
required: true
help: File to download
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
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
# 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
missing required argument: SOURCE
usage: ftp [upload] SOURCE
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
# 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
# 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