Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobdeichert committed Oct 13, 2024
1 parent 1429d65 commit 471eca7
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ mask test

### Positional arguments

These are defined beside the command name within `(round_brackets)`. They are required arguments that must be supplied for the command to run. [Optional args][2] are coming soon. The argument name is injected into the script's scope as an environment variable.
These are defined beside the command name within `(round_brackets)`. They are required arguments that must be supplied for the command to run. The argument name is injected into the script's scope as an environment variable.

**Example:**

Expand All @@ -105,6 +105,24 @@ echo "Testing $test_case in $file"
~~~
```

Optional arguments are defined within `[square_brackets]`.

**Example:**

```markdown
## test [test_file]

> Run tests

~~~bash
if [[ -n "$test_file" ]]; then
echo "Run tests in $test_file..."
else
echo "Running all tests...."
fi
~~~
```

### Named flags

You can define a list of named flags for your commands. The flag name is injected into the script's scope as an environment variable.
Expand Down Expand Up @@ -154,25 +172,22 @@ echo "Total: $(($price * $TAX))"
~~~
```

Coming in v0.11.5: If you add a `choices` list, `mask` will validate if the flag value is one of them.
If you add a `choices` list, `mask` will validate if the flag value is one of them.

**Example:**

```markdown
## print (text)

> Print text with color
## color

**OPTIONS**
* color
* flags: -c --color
* type: string
* choices: RED, BLUE, GREEN
* desc: Color of the text.

~~~sh
COLOR=${color:RED} # Fallback to RED if not supplied
echo "$COLOR: $text"
~~~bash
COLOR=${color:-RED} # Fallback to RED if not supplied
echo "Color selected = '$COLOR'"
~~~
```

Expand Down

0 comments on commit 471eca7

Please sign in to comment.