Skip to content

Commit 335adb0

Browse files
committed
Merge branch 'feature/numeric-arguments' into develop
2 parents d31c13f + 2bb2e60 commit 335adb0

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ argExists 'r' && echo "Found the -O argument"
6969
```bash
7070
-a
7171
-X
72+
-2
7273
-b somevalue
7374
-c 38
7475
-d "some value with spaces"
7576
-e "some value with
7677
newlines"
78+
-7 "ate nine"
7779
```
7880

7981
### Long Form
@@ -86,13 +88,16 @@ newlines"
8688
--long-parameter
8789
--newline "
8890
"
91+
--1337
92+
--365 "days"
8993
```
9094

9195
### Chained Short Form Arguments
9296

9397
```bash
9498
-aih # Equivalent to -a -i -h
9599
-dav 4 # Equivalent to -d -a -v 4
100+
-H3cx # Equivalent to -H -3 -c -x
96101
```
97102

98103
## Argument Order

argument-parser.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22

33
# Define the regex for matching the arguments
4-
regexArgShort='^-([a-zA-Z])$'
5-
regexArgShortChained='^-([a-zA-Z]{2,})$'
6-
regexArgLong='^--([a-zA-Z\-]{2,})$'
4+
regexArgShort='^-([a-zA-Z0-9])$'
5+
regexArgShortChained='^-([a-zA-Z0-9]{2,})$'
6+
regexArgLong='^--([a-zA-Z0-9\-]{2,})$'
77

88
argChunks=()
99

0 commit comments

Comments
 (0)