summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-12-06 17:51:22 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-12-06 17:51:22 +0300
commitc8550c2ba6bc3f80cbad499a6997d0b903580599 (patch)
tree5be0fd2eeafaae659fe476500ddf588d995b9e61
parentfc148d0a1e8fed57f097a0a1e0c6d84641132de7 (diff)
downloadvsvs-c8550c2ba6bc3f80cbad499a6997d0b903580599.tar
vsvs-c8550c2ba6bc3f80cbad499a6997d0b903580599.tar.xz
vsvs-c8550c2ba6bc3f80cbad499a6997d0b903580599.zip
.
-rw-r--r--vsvs-archive14
-rw-r--r--vsvs-name7
-rw-r--r--vsvs-parse (renamed from vsvs-parser)2
3 files changed, 23 insertions, 0 deletions
diff --git a/vsvs-archive b/vsvs-archive
new file mode 100644
index 0000000..aea12ef
--- /dev/null
+++ b/vsvs-archive
@@ -0,0 +1,14 @@
+#!/bin/bash
+# Current directory will be represented as VSVS archive in output.
+# The directory itself should be locked.
+for e in `ls -a`
+do
+ test "$e" == "." || test "$e" == ".." && continue
+ if test -f "$e"
+ then vsvs-name "$e" < $e
+ else
+ cd "$e"
+ vsvs-archive | vsvs-name "$e"
+ cd ..
+ fi
+done
diff --git a/vsvs-name b/vsvs-name
new file mode 100644
index 0000000..709035c
--- /dev/null
+++ b/vsvs-name
@@ -0,0 +1,7 @@
+#!/bin/bash
+# Produce VSVS key-value pair in output,
+# key is passed as $1, value is read from input.
+echo -n "$1"
+while IFS="" read line
+do echo " $line"
+done
diff --git a/vsvs-parser b/vsvs-parse
index c676049..c06e777 100644
--- a/vsvs-parser
+++ b/vsvs-parse
@@ -1,4 +1,6 @@
#!/bin/bash
+# Iterate action over elements from VSVS input,
+# action is passed as $1, it will be evaluated for each key-value pair.
after () { test -z "${2##*$1*}" && echo -n "${2#*$1}"; }
key=""
value=""