Skip to content

Commit de751d0

Browse files
Cleanup --help option and usage information
1 parent 2dec90c commit de751d0

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

experiments/list_unsupported.sh

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
#!/bin/sh
22

3+
# Usage info
4+
usage()
5+
{
6+
echo "Usage:\n\nlist_unsupported.sh path_to_ada_source_folder\n"
7+
echo "Run GNAT2Goto on an Ada repository.\n"
8+
echo "The output is an ordered list of currently unsupported features"
9+
echo "with the number of times they occur in the input repository.\n"
10+
echo "The script builds a parsing program using collect_unsupported.cpp and expects"
11+
echo "this file to be in the same folder.\n"
12+
}
13+
314
# First check some environment prerequisites
415
echo >&2 "Checking environment..."
516

@@ -12,21 +23,6 @@ if ! command -v gnat2goto > /dev/null; then
1223
exit 1
1324
fi
1425

15-
if [ "$#" -ne 1 ]; then
16-
echo >&2 "Provide folder name to start"
17-
exit 2
18-
fi
19-
20-
if [ "$1" = '--help' ]; then
21-
echo "Run GNAT2Goto on an Ada repository.\n"
22-
echo "The output is an ordered list of currently unsupported features"
23-
echo "with the number of times they occur in the input repository.\n"
24-
echo "The script builds a parsing program using collect_unsupported.cpp and expects"
25-
echo "this file to be in the same folder.\n"
26-
echo "Usage:\n\nlist_unsupported.sh path_to_ada_source_folder"
27-
exit 3
28-
fi
29-
3026
# gnat on the path?
3127
if ! command -v gnat > /dev/null; then
3228
echo >&2 "Gnat not on PATH!"
@@ -94,6 +90,20 @@ export PATH="${saved_path}"
9490

9591
echo >&2 "...environment is OK."
9692

93+
94+
# Command line processing....
95+
96+
if [ "$1" = '--help' ]; then
97+
usage
98+
exit
99+
fi
100+
101+
if [ "$#" -ne 1 ]; then
102+
usage >&2
103+
echo >&2 "Only a single folder name may be specified"
104+
exit 2
105+
fi
106+
97107
# Finally start work
98108

99109
echo >&2 "Project to build: $1"

0 commit comments

Comments
 (0)