You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `argumentName` part of the definition is the name given to the argument and what should be passed to the `argValue` and `argExists` functions, see below. The argument name is case sensitive and must not contain spaces or an equals sign.
46
+
The `argumentName` part of the definition is the name given to the argument and what should be passed to the `argValue` and `argPassed` functions, see below. The argument name is case sensitive and must not contain spaces or an equals sign.
47
47
48
48
By default if an argument is passed that hasn't been defined an error will be thrown and the script will exit.
49
49
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).
@@ -65,7 +65,8 @@ The default value can also be set to an empty string (`argExpected['e']="argumen
65
65
There is a helper function named `argValue()` which takes the name of
66
66
an argument as its only parameter and returns the value given to the argument.
67
67
68
-
If the argument doesn't have a value or hasn't been passed nothing is returned.
68
+
If the argument doesn't have a value or hasn't been passed nothing is returned
69
+
unless it's been given a default, in which case the default value will be returned.
69
70
70
71
```bash
71
72
# -a 'some text'
@@ -100,30 +101,32 @@ esac
100
101
101
102
### Check If An Argument Has Been Passed
102
103
103
-
There is a helper function named `argExists()` which takes the name of
104
+
There is a helper function named `argPassed` which takes the name of
104
105
an argument as its only parameter and returns a boolean.
105
106
107
+
`argPassed` will return false if the argument has fallen back to its default value*
0 commit comments