Switch experiment README to .md
[khome.git] / home / bin / x
index 0faa918..1687114 100755 (executable)
@@ -2,20 +2,17 @@
 
 set -e;
 
-name="$1";
+README='README.md'
 
-if [ "$name" != "" ];
-then
-    timestamp=`date +'%F--%H-%M--%S'`;
-    directory="$HOME/x/$timestamp--$name";
-    mkdir -p "$directory";
-    cd "$directory";
-    echo "# $name\n" > README.md;
-    git init >&2
-    git add . >&2
-    git commit -m 'Initial commit' >&2
-    echo "$directory";
-else
-    echo "Please give the experiment a name, as the first argument.";
-    exit 1;
-fi;
+name=$(echo "$@" | sed 's/\s\+/-/g');
+timestamp=$(date +'%F--%H-%M-%S');
+directory="$HOME/x/$timestamp--$name";
+mkdir -p "$directory";
+cd "$directory";
+printf '%s\n' "$name" > "$README";
+seq 80 | xargs | sed -E 's/\s*[0-9]+\s*/=/g' >> "$README"
+git init >&2
+git commit --allow-empty -m 'Root commit' >&2
+git add . >&2
+git commit -m 'Initial commit' >&2
+echo "$directory";
This page took 0.028776 seconds and 4 git commands to generate.