diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-14 10:32:24 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-14 10:32:24 +0200 |
commit | 44b2652f72402b5155f99b9550296c4337689491 (patch) | |
tree | b4f2a15f8654e1bbae300a11cddad7cff6f258ff /.app/lib | |
parent | 7bb8f6710c94260f05f6d88910864e2b25484e6c (diff) | |
download | app.sh-44b2652f72402b5155f99b9550296c4337689491.tar.gz app.sh-44b2652f72402b5155f99b9550296c4337689491.tar.bz2 app.sh-44b2652f72402b5155f99b9550296c4337689491.tar.xz app.sh-44b2652f72402b5155f99b9550296c4337689491.zip |
o Tests for 'list' and 'list-versions'.
o Adding support for -i for 'list'.
Diffstat (limited to '.app/lib')
-rw-r--r-- | .app/lib/app-app | 11 | ||||
-rw-r--r-- | .app/lib/app-common | 9 |
2 files changed, 14 insertions, 6 deletions
diff --git a/.app/lib/app-app b/.app/lib/app-app index c9da2d7..cb87847 100644 --- a/.app/lib/app-app +++ b/.app/lib/app-app @@ -318,12 +318,12 @@ method_list_usage() { method_list() { local filter_name="$1"; shift - local instance="$1"; shift + local filter_instance="$1"; shift local mode="pretty" local vars local filter_name - while getopts "P:n:" opt + while getopts "P:n:i:" opt do case $opt in P) @@ -333,6 +333,9 @@ method_list() { n) filter_name=$OPTARG ;; + i) + filter_instance=$OPTARG + ;; \?) method_list_usage "Invalid option: -$OPTARG" ;; @@ -347,12 +350,12 @@ method_list() { if [ $mode = "pretty" ] then printf "%-20s %-20s %-20s\n" "Name" "Instance" "Version" - list_apps "$filter_name" name instance version | (IFS=:; while read name instance version + list_apps "$filter_name" "$filter_instance" name instance version | (IFS=:; while read name instance version do printf "%-20s %-20s %-20s\n" "$name" "$instance" "$version" done) else - list_apps "$filter_name" $vars + list_apps "$filter_name" "$filter_instance" $vars fi } diff --git a/.app/lib/app-common b/.app/lib/app-common index 11e724b..584e053 100644 --- a/.app/lib/app-common +++ b/.app/lib/app-common @@ -33,8 +33,8 @@ assert_is_instance() { } list_apps() { - filter_name=$1 - shift + filter_name=$1; shift + filter_instnace=$1; shift vars="$@" sort $BASEDIR/.app/var/list | while read line @@ -46,6 +46,11 @@ list_apps() { continue fi + if [ -n "$filter_instance" -a "$filter_instance" != "$instance" ] + then + continue + fi + local line="" IFS=" "; for var in $vars do |