Skip to content

Commit 471eca7

Browse files
committed
Update README
1 parent 1429d65 commit 471eca7

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ mask test
9191

9292
### Positional arguments
9393

94-
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.
94+
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.
9595

9696
**Example:**
9797

@@ -105,6 +105,24 @@ echo "Testing $test_case in $file"
105105
~~~
106106
```
107107

108+
Optional arguments are defined within `[square_brackets]`.
109+
110+
**Example:**
111+
112+
```markdown
113+
## test [test_file]
114+
115+
> Run tests
116+
117+
~~~bash
118+
if [[ -n "$test_file" ]]; then
119+
echo "Run tests in $test_file..."
120+
else
121+
echo "Running all tests...."
122+
fi
123+
~~~
124+
```
125+
108126
### Named flags
109127

110128
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.
@@ -154,25 +172,22 @@ echo "Total: $(($price * $TAX))"
154172
~~~
155173
```
156174

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

159177
**Example:**
160178

161179
```markdown
162-
## print (text)
163-
164-
> Print text with color
180+
## color
165181

166182
**OPTIONS**
167183
* color
168184
* flags: -c --color
169185
* type: string
170186
* choices: RED, BLUE, GREEN
171-
* desc: Color of the text.
172187

173-
~~~sh
174-
COLOR=${color:RED} # Fallback to RED if not supplied
175-
echo "$COLOR: $text"
188+
~~~bash
189+
COLOR=${color:-RED} # Fallback to RED if not supplied
190+
echo "Color selected = '$COLOR'"
176191
~~~
177192
```
178193

0 commit comments

Comments
 (0)