Skip to content

Support shorter flag syntax #56

@brandonkal

Description

@brandonkal

Currently adding a flag is quite verbose:

## purchase (price)

> Calculate the total price of something.

**OPTIONS**
* tax
    * flags: -t --tax
    * type: number
    * desc: What's the tax?

~~~sh
TAX=${tax:-1} # Fallback to 1 if not supplied
echo "Total: $(($price * $TAX))"
~~~

We end needing to write out the flag name twice and use 4 lines.
I'd like to propose support for a shorter readable syntax:

## purchase (price)

> Calculate the total price of something.

**OPTIONS**
* flags: -t --tax |number| What's the tax?

~~~sh
TAX=${tax:-1} # Fallback to 1 if not supplied
echo "Total: $(($price * $TAX))"
~~~

If no type is specified, the |number| part can be omitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions