Migrate git-instaweb.sh to use git-rev-parse --parseopt
Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pierre Habouzit committed
Nov 4, 2007 at 11:30 UTC
c2db2e0ef1df6ea2d0aeca1df347c7143a1a2e1c
1 file changed
+30
-44
git-instaweb.sh
+30
-44
@@ -2,9 +2,21 @@
2
#
3
# Copyright (c) 2006 Eric Wong
4
#
5
-USAGE='[--start] [--stop] [--restart]
6
- [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]
7
- [--module-path=<path> (for Apache2 only)]'
5
+
6
+OPTIONS_KEEPDASHDASH=
7
+OPTIONS_SPEC="\
8
+git-instaweb [options] (--start | --stop | --restart)
9
+--
10
+l,local only bind on 127.0.0.1
11
+p,port= the port to bind to
12
+d,httpd= the command to launch
13
+b,browser= the browser to launch
14
+m,module-path= the module path (only needed for apache2)
15
+ Action
16
+stop stop the web server
17
+start start the web server
18
+restart restart the web server
19
+"
20
21
. git-sh-setup
22
@@ -78,52 +90,26 @@ do
90
start_httpd
91
exit 0
92
;;
81
- --local|-l)
93
+ -l|--local)
94
local=true
95
;;
84
- -d|--httpd|--httpd=*)
85
- case "$#,$1" in
86
- *,*=*)
87
- httpd=`expr "$1" : '-[^=]*=\(.*\)'` ;;
88
- 1,*)
89
- usage ;;
90
- *)
91
- httpd="$2"
92
- shift ;;
93
- esac
96
+ -d|--httpd)
97
+ shift
98
+ httpd="$1"
99
+ ;;
100
+ -b|--browser)
101
+ shift
102
+ browser="$1"
103
;;
95
- -b|--browser|--browser=*)
96
- case "$#,$1" in
97
- *,*=*)
98
- browser=`expr "$1" : '-[^=]*=\(.*\)'` ;;
99
- 1,*)
100
- usage ;;
101
- *)
102
- browser="$2"
103
- shift ;;
104
- esac
104
+ -p|--port)
105
+ shift
106
+ port="$1"
107
;;
106
- -p|--port|--port=*)
107
- case "$#,$1" in
108
- *,*=*)
109
- port=`expr "$1" : '-[^=]*=\(.*\)'` ;;
110
- 1,*)
111
- usage ;;
112
- *)
113
- port="$2"
114
- shift ;;
115
- esac
108
+ -m|--module-path)
109
+ shift
110
+ module_path="$1"
111
;;
117
- -m|--module-path=*|--module-path)
118
- case "$#,$1" in
119
- *,*=*)
120
- module_path=`expr "$1" : '-[^=]*=\(.*\)'` ;;
121
- 1,*)
122
- usage ;;
123
- *)
124
- module_path="$2"
125
- shift ;;
126
- esac
112
+ --)
113
;;
114
*)
115
usage