mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
jw-pkg: Add command get-value-from-tables
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
6109703ccb
commit
5e66868557
1 changed files with 32 additions and 1 deletions
|
|
@ -328,6 +328,37 @@ cmd_compile_templates()
|
|||
fi
|
||||
}
|
||||
|
||||
cmd_get_value_from_tables()
|
||||
{
|
||||
local key show_file
|
||||
eval set -- `getopt -- k: "$@"`
|
||||
while [ "$1" != -- ]; do
|
||||
case $1 in
|
||||
-k)
|
||||
key=$2
|
||||
shift
|
||||
;;
|
||||
-f)
|
||||
show_file=1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo -e "Unexpected argument >$1<\n" >&2
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
shift
|
||||
|
||||
local f
|
||||
while read f; do
|
||||
grep -q "^\s*$key\s\+" $f || continue
|
||||
[ "$show_file" = 1 ] && echo -n "$f: "
|
||||
sed "s|^[ ]*#.*||; /^\s*$key\(\s\|=\)\+/ !d; s/^\s*$key\(\s\|=\)\+//" $f
|
||||
done <<< $(cmd_list_template_tables "$@")
|
||||
}
|
||||
|
||||
cmd_built_today()
|
||||
{
|
||||
local today=`date +'%Y-%m-%d'`
|
||||
|
|
@ -410,7 +441,7 @@ list)
|
|||
list_projects)
|
||||
list_projects "$@"
|
||||
;;
|
||||
compile_templates|list_templates|list_template_tables|list_template_output|rm_template_output|diff|build_date|built_today|rpmnew)
|
||||
compile_templates|list_templates|list_template_tables|list_template_output|rm_template_output|diff|build_date|built_today|rpmnew|get_value_from_tables)
|
||||
cmd_$cmd "$@"
|
||||
;;
|
||||
help)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue