Skip to content

Commit a3e22a4

Browse files
committed
Added a section to the README about the default values
1 parent 98c3088 commit a3e22a4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ The `argumentName` part of the definition is the name given to the argument and
4646
By default if an argument is passed that hasn't been defined an error will be thrown and the script will exit.
4747
This feature can be turned off by setting `ARG_MUST_BE_DEFINED` to `false`, note that the argument names will default to the argument its self, without the preceding hyphen(s).
4848

49+
### Defining Argument Default Values
50+
51+
You can define a default value that will be used if the argument isn't passed:
52+
53+
```
54+
# Set the -e arguments default value to 900
55+
argExpected['e']="argumentName=900 - Argument description"
56+
```
57+
58+
Now if the script is called and the `-e` argument is omitted `argValue "argumentName"` will return `900`
59+
The default value can also be set to an empty string (`argExpected['e']="argumentName= - Argument description"`)
60+
4961
### Get An Arguments Value
5062

5163
There is a helper function named `argValue()` which takes the name of

0 commit comments

Comments
 (0)