1 | #!/bin/sh |
---|
2 | |
---|
3 | PORT="" |
---|
4 | OPTS="" |
---|
5 | |
---|
6 | while [ $# != 0 ] ;do |
---|
7 | case $1 in |
---|
8 | --editor) |
---|
9 | shift |
---|
10 | EDITOR="$1" |
---|
11 | if [ "${EDITOR}" = "native" ] ;then |
---|
12 | EDITOR="open -t" |
---|
13 | fi |
---|
14 | ;; |
---|
15 | -*) |
---|
16 | OPTS="${OPTS} $1" |
---|
17 | ;; |
---|
18 | *) |
---|
19 | PORT="${PORT} $1" |
---|
20 | ;; |
---|
21 | esac |
---|
22 | shift |
---|
23 | done |
---|
24 | |
---|
25 | if [ "${EDITOR}" != "" -a "${PORT}" != "" ] ;then |
---|
26 | for p in $PORT ;do |
---|
27 | WD="`port work ${p}`" |
---|
28 | if [ -d ${WD} ] ;then |
---|
29 | #echo ${EDITOR} ${OPTS} ${WD}/.macports.${p}.state |
---|
30 | ${EDITOR} ${OPTS} ${WD}/.macports.${p}.state |
---|
31 | fi |
---|
32 | done |
---|
33 | else |
---|
34 | echo "Usage: `basename $0` [--editor app] [-options] <port1> [port2 [port3 [...]]]" |
---|
35 | echo "This utility allows you to edit the statefile from a port's work directory" |
---|
36 | echo "Use --editor native to invoke the default native text editor" |
---|
37 | echo "Remember to quote spaces in the editor app name or in options that take an argument" |
---|
38 | echo " (e.g. `basename $0` \"-t tabsize\") foo" |
---|
39 | fi |
---|