]> gitweb.fluxo.info Git - metadot.git/commitdiff
Enhance documentation and usage
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 21 Mar 2017 22:37:27 +0000 (19:37 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 21 Mar 2017 22:37:27 +0000 (19:37 -0300)
README.mdwn
metadot

index 0e3f80a7e82b5df96e308bbd1365d4fbc3473737..8ef33d6cb1b5148151eb9b86970acfb79b9aaceb 100644 (file)
@@ -6,7 +6,7 @@ by simply cloning then to your `~/.dotfiles/modules` and renaming a few files.
 
 By being modular, it's possible to create modules for specific applications
 (vim, mutt, emacs, git, etc). By using git submodules or subtrees, one can even
-create her own dotfile bundle.
+create her own dotfile collection.
 
 It was inspired by [holman does dotfiles](https://github.com/holman/dotfiles)
 and many other initiatives but with a modular design to ease dotfile sharing as
@@ -23,10 +23,13 @@ Then check the source integrity of the latest release:
 
     /usr/bin/git -C metadot verify-commit HEAD
 
+Note that `/usr/bin/git` is called to avoid any other `git` wrappers or aliases
+you might have available on your shell.
+
 Save the metadot repository anywhere but make sure it's available in your `$PATH`.
 I'm my config I use `~/apps/metadot`.
 
-Then get some modules. You can get the whole standard module bundle with
+Then get some modules. You can get the whole standard module collection with
 
     metadot clone https://git.fluxo.info/rhatto/dotfiles
 
@@ -34,13 +37,13 @@ Or simply using
 
     metadot clone default
 
-Modules names as `dotfiles` have a special meaning and are handled like bundles
+Modules names as `dotfiles` have a special meaning and are handled like collections
 and are cloned directly as `~/.dotfiles`. After cloning, you can check the current
 dotfiles revision using
 
     metadot version
 
-Third-party bundles will hardly suit your needs, so you can fetch individual
+Third-party collections will hardly suit your needs, so you can fetch individual
 modules:
 
     metadot clone https://git.fluxo.info/rhatto/dotfiles/vim
@@ -51,8 +54,8 @@ Or even start your own:
 
 In both cases your `vim` module will be available at `~/.dotfiles/modules/vim`.
 
-You can use just one bundle at a time. While you can mixed a bundle with
-individual modules, it's more sane to just start your own bundle and keep
+You can use just one collection at a time. While you can mixed a collection with
+individual modules, it's more sane to just start your own collection and keep
 modules as git submodules or subtrees.
 
 Usage
@@ -70,7 +73,7 @@ Load all modules:
 
     metadot load --all
 
-Update a module bundle or all individual modules:
+Update a module collection or all individual modules:
 
     metadot update
 
diff --git a/metadot b/metadot
index 79ca0bbd963381b0ccf83801c4883fda1d03b21a..011091c9179c61e2744b225622357988eef3d4dd 100755 (executable)
--- a/metadot
+++ b/metadot
@@ -53,7 +53,7 @@ function metadot_backup {
 }
 
 # Find contents of a module
-function metadot_find {
+function __metadot_find {
   local module="$1"
   ( cd $MODULES/$module && find -name '*.link' -or -name '*.dot.link' ) | grep -v '.git/modules' | sed -e 's|./||'
 }
@@ -68,7 +68,7 @@ function metadot_load {
 
     echo "Loading module $module..."
 
-    for file in `metadot_find $module`; do
+    for file in `__metadot_find $module`; do
       echo "Processing $file..."
 
       # Get the dirname, replacing string.dot with .string
@@ -160,6 +160,11 @@ function metadot_update {
 # Basic usage
 function metadot_usage {
   echo "usage: $BASENAME <option> [arguments]"
+  echo ""
+  echo "available actions:"
+  echo ""
+  grep "^function metadot_" $0 | cut -d ' ' -f 2 | sed -e 's/metadot_/\t/' -e 's/_/-/g' | sort
+  echo ""
   exit 1
 }
 
@@ -196,7 +201,7 @@ function metadot_installed {
 }
 
 # Process modules
-function metadot_process_modules {
+function __metadot_process_modules {
   if [ -z "$1" ]; then
     echo "usage: $BASENAME $OPT [module(s)|--all]"
   fi
@@ -217,7 +222,7 @@ function metadot_process_modules {
 }
 
 # Process bundle
-function metadot_process_bundle {
+function __metadot_process_bundle {
   local bundle="$1"
   local dependency
   local option
@@ -265,16 +270,33 @@ function metadot_ls_bundle {
   cat $DOT/bundles/$bundle
 }
 
+# Display version
+function metadot_version {
+  ( cd $DOT && git log --show-signature -n 1 )
+}
+
+# Load a bundle
+function metadot_load_bundle {
+  __metadot_process_bundle $*
+}
+
+# Process bundle dependencies
+function metadot_deps_bundle {
+  __metadot_process_bundle $*
+}
+
 # Parsing
 if [ -z "$OPT" ]; then
   metadot_usage
+elif [ "$OPT" == "usage" ]; then
+  metadot_usage
 elif [ "$OPT" == "ls" ]; then
   metadot_ls
 elif [ "$OPT" == "ls-bundle" ]; then
   shift
   metadot_ls_bundle $*
 elif [ "$OPT" == "version" ]; then
-  ( cd $DOT && git log --show-signature -n 1 )
+  metadot_version
 elif [ "$OPT" == "update" ]; then
   metadot_update
 elif [ "$OPT" == "backup" ]; then
@@ -287,10 +309,13 @@ elif [ "$OPT" == "create" ]; then
   metadot_create $*
 elif [ "$OPT" == "load" ] || [ "$OPT" == "deps" ]; then
   shift
-  metadot_process_modules $*
-elif [ "$OPT" == "load-bundle" ] || [ "$OPT" == "deps-bundle" ]; then
+  __metadot_process_modules $*
+elif [ "$OPT" == "load-bundle" ]; then
+  shift
+  metadot_load_bundle $*
+elif [ "$OPT" == "deps-bundle" ]; then
   shift
-  metadot_process_bundle $*
+  metadot_deps_bundle $*
 elif [ "$OPT" == "installed" ]; then
   metadot_installed
 fi