#!/usr/bin/env bash
set -e

# @describe A demo CLI with subcommands, flags, options, and positional args

# @cmd Upload a file
# @alias    u
# @option   --visibility[public|private]  Set file visibility
# @arg target!                            File to upload
upload() {
    echo "cmd:                      upload"
    echo "option: --visibility      $argc_visibility"
    echo "arg:    target            $argc_target"
}

# @cmd Download a file
# @alias    d
# @flag     -f --force              Override existing file
# @option   -t --tries=3 <NUM>      Set max retries to NUM
# @arg      source!                 Url to download from
# @arg      target                  Save file to
download() {
    echo "cmd:                      download"
    echo "flag:   --force           $argc_force"
    echo "option: --tries           $argc_tries"
    echo "arg:    source            $argc_source"
    echo "arg:    target            $argc_target"
}

eval "$(argc --argc-eval "$0" "$@")"
