Skip to content

Commit 71f8f6a

Browse files
committed
Added a Use section to the README
1 parent 617c50c commit 71f8f6a

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,42 @@
22

33
Takes arguments passed in nearly any format to a bash script and allows easy access to them and their values
44

5+
## Use
6+
7+
### Get An Arguments Value
8+
9+
Get the value of the `--debug 3` flag
10+
11+
```bash
12+
DEBUG="${args['debug']}" # 3
13+
```
14+
15+
### Check If An Argument Has Been Passed
16+
17+
Check for the `-v` flag
18+
19+
```bash
20+
if argExists 'v'; then
21+
echo "The -v flag has been passed"
22+
fi
23+
24+
# Or
25+
26+
argExists 'v' && echo "Verbosity Enabled"
27+
```
28+
29+
Check for the `--test` flag
30+
31+
```bash
32+
if argExists 'test'; then
33+
echo "The --test flag has been passed"
34+
fi
35+
36+
# Or
37+
38+
argExists 'test' && echo "Testing enabled"
39+
```
40+
541
## Supported Argument Formats
642

743
### Short Form

0 commit comments

Comments
 (0)