summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-10-07 19:52:45 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-10-07 19:52:45 +0200
commit978a886908af800a77b6ec3a51e4c6e80a6d6fff (patch)
tree16924fd4ac050c54d4959e379ed2168bb126cd29
parent1af970e428fcca786a579b85e9199f8cd7efa316 (diff)
downloadapp.sh-978a886908af800a77b6ec3a51e4c6e80a6d6fff.tar.gz
app.sh-978a886908af800a77b6ec3a51e4c6e80a6d6fff.tar.bz2
app.sh-978a886908af800a77b6ec3a51e4c6e80a6d6fff.tar.xz
app.sh-978a886908af800a77b6ec3a51e4c6e80a6d6fff.zip
o Adding a -n option to 'list' to list only instances for a single application.
-rwxr-xr-xapp20
1 files changed, 15 insertions, 5 deletions
diff --git a/app b/app
index 137f532..97be044 100755
--- a/app
+++ b/app
@@ -352,13 +352,17 @@ method_stop() {
method_list() {
local mode="pretty"
- while getopts "P" opt
+ while getopts "Pn:" opt
do
case $opt in
P)
mode="parseable"
shift
;;
+ n)
+ filter_name=$OPTARG
+ shift
+ ;;
\?)
install_usage "Invalid option: -$OPTARG"
;;
@@ -383,9 +387,15 @@ method_list() {
printf "%-20s %-20s %-20s\n" "Name" "Instance" "Version"
fi
- sort $BASEDIR/.app/var/list | (
- IFS=:; while read instance name version
+ sort $BASEDIR/.app/var/list | while read line
+ do
+ echo $line | (IFS=:; while read name instance version
do
+ if [ "$filter_name" != "" -a "$filter_name" != "$name" ]
+ then
+ continue
+ fi
+
if [ $mode = "pretty" ]
then
printf "%-20s %-20s %-20s\n" "$name" "$instance" "$version"
@@ -403,8 +413,8 @@ method_list() {
done
echo $line
fi
- done
- )
+ done)
+ done
}
method_usage() {