From 4993204e9d7859a259c1d6210abb89dc2060276e Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Fri, 8 Apr 2016 13:37:11 +0100 Subject: [PATCH] add a find option to mobyconfig Signed-off-by: Justin Cormack --- alpine/packages/mobyconfig/mobyconfig | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/alpine/packages/mobyconfig/mobyconfig b/alpine/packages/mobyconfig/mobyconfig index f6a01abab..2c9dbe4e2 100755 --- a/alpine/packages/mobyconfig/mobyconfig +++ b/alpine/packages/mobyconfig/mobyconfig @@ -2,7 +2,7 @@ if [ $# -ne 2 ] then - printf "usage: $0 [get|exists|watch|path|dir] key\n" + printf "usage: $0 [get|exists|watch|path|dir|find] key\n" exit 0 fi @@ -69,6 +69,18 @@ then fi fi +if [ $1 == "find" ] +then + if [ -e ${BASE}/${KEY} ] + then + find ${BASE}/${KEY} -type f + exit 0 + else + printf "No such key: ${KEY}\n" 1>&2 + exit 1 + fi +fi + # might be nicer if watch returned a file descriptor not a path # /Database/branch/master/watch/com.docker.driver.amd64-linux.node/etc.node/docker.node/daemon.json.node/tree.live if [ $1 == "watch" ] @@ -85,5 +97,5 @@ then fi fi -printf "usage: $0 [get|exists|watch|path|dir] key\n" +printf "usage: $0 [get|exists|watch|path|dir|find] key\n" exit 1