aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rwxr-xr-xbin/app-conf15
-rw-r--r--docs/Makefile8
-rwxr-xr-xtest/app-conf.bats20
4 files changed, 41 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 3c70c2a..5299b29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@ apps.list
downloads
target
docs/*.html
+docs/*.1
.app/var
/*/.gitignore
diff --git a/bin/app-conf b/bin/app-conf
index cd127a2..96e52cf 100755
--- a/bin/app-conf
+++ b/bin/app-conf
@@ -151,9 +151,22 @@ case "$command" in
app-cat-conf -l "$location" | format_conf
;;
set)
+ while getopts "f:" opt
+ do
+ case $opt in
+ f)
+ file="$OPTARG"
+ shift 2;
+ ;;
+ *)
+ usage "Unknown argument: $OPTARG"
+ ;;
+ esac
+ done
+
if [ $# -ne 2 ]
then
- usage "Expected exactly two arguments"
+ usage "Expected exactly two arguments."
fi
conf_set "$file" "$1" "$2"
diff --git a/docs/Makefile b/docs/Makefile
index f9ae4ea..c62e70c 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1,9 +1,13 @@
TXT=$(wildcard *.txt)
HTML=$(patsubst %.txt,%.html,$(TXT))
-all: $(HTML)
+MAN=$(patsubst %.txt,%.1,$(TXT))
+all: $(HTML) $(MAN)
%.html: %.txt
asciidoc -a data-uri -a icons -a toc -a max-width=55em $<
+%.1: %.txt
+ a2x --doctype manpage --format manpage $<
+
clean:
- rm -rf $(wildcard *.html)
+ rm -rf $(wildcard *.html) $(wildcard *.1)
diff --git a/test/app-conf.bats b/test/app-conf.bats
index 5c5da05..97041cd 100755
--- a/test/app-conf.bats
+++ b/test/app-conf.bats
@@ -103,6 +103,26 @@ setup_inner() {
eq '${#lines[*]}' 2
}
+@test "./app conf set -f" {
+ echo "" > .app/config
+
+ app conf set -f myconfig group.foo bar
+ eq '${#lines[*]}' 0
+
+ app_libexec app-cat-conf -f myconfig
+ eq '${lines[0]}' "group.foo=bar"
+ eq '${#lines[*]}' 1
+
+ run cat .app/config
+ eq '$status' 0
+ eq '${#lines[*]}' 0
+
+ run cat myconfig
+ eq '$status' 0
+ eq '${lines[0]}' "group.foo=bar"
+ eq '${#lines[*]}' 1
+}
+
@test "./app conf set - values with '=' and spaces" {
echo > .app/config
app conf set app.env "JAVA_OPTS=-Xmx1G -Dawesome=true"