Skip to content

Commit 4e1ec19

Browse files
committed
Sort commandline options
1 parent d943f04 commit 4e1ec19

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

mgitstatus

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ repositories. By default, mgitstatus scans two directories deep. This can be
1515
changed with the -d (--depth) option. If DEPTH is 0, the scan is infinitely
1616
deep.
1717
18-
--version Show version
19-
-w Warn about dirs that are not Git repositories
20-
-e Exclude repos that are 'ok'
21-
-f Do a 'git fetch' on each repo (slow for many repos)
22-
--throttle SEC Wait SEC seconds between each 'git fetch' (-f option)
2318
-c Force color output (preserve colors when using pipes)
2419
-d, --depth=2 Scan this many directories deep
25-
--no-depth Do not recurse into directories (incompatible with -d)
20+
-e Exclude repos that are 'ok'
21+
-f Do a 'git fetch' on each repo (slow for many repos)
2622
--flatten Show only one status per line
23+
--no-depth Do not recurse into directories (incompatible with -d)
24+
--throttle SEC Wait SEC seconds between each 'git fetch' (-f option)
25+
--version Show version
26+
-w Warn about dirs that are not Git repositories
2727
2828
You can limit output with the following options:
2929
@@ -58,29 +58,33 @@ while [ -n "$1" ]; do
5858
# Stop reading when we've run out of options.
5959
[ "$(printf "%s" "$1" | cut -c 1)" != "-" ] && break
6060

61-
if [ "$1" = "--version" ]; then
62-
echo "v$VERSION"
63-
exit 0
64-
fi
65-
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
66-
usage
67-
exit 1
61+
if [ "$1" = "-c" ]; then
62+
FORCE_COLOR=1
6863
fi
69-
if [ "$1" = "-w" ]; then
70-
WARN_NOT_REPO=1
64+
if [ "$1" = "-d" ] || [ "$1" = "--depth" ]; then
65+
DEPTH="$2"
66+
echo "$DEPTH" | grep -E "^[0-9]+$" > /dev/null 2>&1
67+
IS_NUM="$?"
68+
if [ "$IS_NUM" -ne 0 ]; then
69+
echo "Invalid value for 'depth' (must be a number): $DEPTH" >&2
70+
exit 1
71+
fi
72+
# Shift one extra param
73+
shift
7174
fi
7275
if [ "$1" = "-e" ]; then
7376
EXCLUDE_OK=1
7477
fi
7578
if [ "$1" = "-f" ]; then
7679
DO_FETCH=1
7780
fi
78-
if [ "$1" = "-c" ]; then
79-
FORCE_COLOR=1
80-
fi
8181
if [ "$1" = "--flatten" ]; then
8282
FLATTEN=1
8383
fi
84+
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
85+
usage
86+
exit 1
87+
fi
8488
if [ "$1" = "--no-push" ]; then
8589
NO_PUSH=1
8690
fi
@@ -118,16 +122,12 @@ while [ -n "$1" ]; do
118122
# Shift one extra param
119123
shift
120124
fi
121-
if [ "$1" = "-d" ] || [ "$1" = "--depth" ]; then
122-
DEPTH="$2"
123-
echo "$DEPTH" | grep -E "^[0-9]+$" > /dev/null 2>&1
124-
IS_NUM="$?"
125-
if [ "$IS_NUM" -ne 0 ]; then
126-
echo "Invalid value for 'depth' (must be a number): $DEPTH" >&2
127-
exit 1
128-
fi
129-
# Shift one extra param
130-
shift
125+
if [ "$1" = "--version" ]; then
126+
echo "v$VERSION"
127+
exit 0
128+
fi
129+
if [ "$1" = "-w" ]; then
130+
WARN_NOT_REPO=1
131131
fi
132132

133133
shift

0 commit comments

Comments
 (0)