]> gitweb.fluxo.info Git - templater.git/commitdiff
On creating modules with templater and a basic trashman module
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 12 Nov 2017 12:16:23 +0000 (10:16 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 12 Nov 2017 12:16:23 +0000 (10:16 -0200)
README.md
share/templater/trashman/description [new file with mode: 0644]
share/templater/trashman/setup [new file with mode: 0755]

index 408975ad4121d140cf67095d7a93da82fe013e5f..1c036291a1d82b6f12c86a0c6e55c3802e2df156 100644 (file)
--- a/README.md
+++ b/README.md
@@ -72,3 +72,7 @@ Example: when you call `templater myproject basic`, templater finds a script
 at `$path_to_templater_install/share/basic/setup` and execs it like this:
 
     cd myproject && share/basic/setup $path_to_templater_install/share/templater
+
+You might even use `templater` to create a module:
+
+    cd path/to/templater/repo && templater share/templater/<module_name> templater
diff --git a/share/templater/trashman/description b/share/templater/trashman/description
new file mode 100644 (file)
index 0000000..ba436e5
--- /dev/null
@@ -0,0 +1 @@
+Trashman package skeleton
diff --git a/share/templater/trashman/setup b/share/templater/trashman/setup
new file mode 100755 (executable)
index 0000000..6d4ae55
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Trashman package templater module.
+#
+
+# Parameters
+SHARE="$1"
+
+# Include basic functions
+source $SHARE/templater/functions || exit 1
+
+# Templater module
+function templater_trashman {
+  if [ ! -e "description" ]; then
+    __templater_echo "Setting Trashman package"
+
+    touch info
+    mkdir unix
+  else
+    __templater_echo "Trashman package already set"
+  fi
+}
+
+# Dispatch
+templater_trashman