Skip to content

Commit e172bc8

Browse files
committed
Updated the README concerning not needing to call argParse anymore
1 parent d158e8a commit e172bc8

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
# BASH Argument Parser
22

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

55
## Use
66

77
### How To Use
88

9-
Just include the library in the head of script, define all the arguments you need and call the parser function
9+
Just define all the arguments you need and include the library in the head of script, that's it.
1010

1111
```bash
12-
# Include the Argument Parser library
13-
source ./my/lib/path/argument-parser.sh
14-
1512
# Define the expected arguments
13+
declare -A argExpected
1614
argExpected['test']="argName - This is a short description of the argument and what it does"
1715
argExpected['R']="secondArgName - This is another argument that can be passed"
1816

19-
# Parse any arguments
20-
argParse
17+
# Include and run the Argument Parser library
18+
source ./my/lib/path/argument-parser.sh
2119
```
2220

2321
### Defining Expected Arguments
2422

25-
The argument parser can take an array of arguments to expect, it has the following format:
23+
The argument parser takes an array of arguments to expect, it has the following format:
2624

2725
```bash
26+
# Define argExpected as an associative array
27+
# This must occur once before you build the array of argument definitions
28+
declare -A argExpected
29+
2830
# Define the -r argument
2931
argExpected['r']="argumentName - Argument description"
3032

@@ -186,7 +188,7 @@ The order the arguments are passed on the command line makes a difference
186188

187189
## Debug Mode
188190

189-
There is a debug mode that can be enabled by setting the `ARG_DEBUG` variable to `true` right before calling `argParse`.
191+
There is a debug mode that can be enabled by setting the `ARG_DEBUG` variable to `true` right before including the library.
190192
This will cause the script to dump out information about which flags it finds and of what kind etc
191193

192194
## Testing

0 commit comments

Comments
 (0)