diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-07 19:52:45 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-07 19:52:45 +0200 |
commit | 978a886908af800a77b6ec3a51e4c6e80a6d6fff (patch) | |
tree | 16924fd4ac050c54d4959e379ed2168bb126cd29 | |
parent | 1af970e428fcca786a579b85e9199f8cd7efa316 (diff) | |
download | app.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-x | app | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -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() { |