X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=home%2Fbin%2Fx;h=3961b853027567e88ceec3f99fba600bfc17c650;hb=4ac02602d43aa8df8a2c043d35da312eb27a08da;hp=0faa9183439b103d3fc6a1bd36107446abccccf8;hpb=1be8e74bb12167f8e6adf899612b20cfb16a9ce5;p=khome.git diff --git a/home/bin/x b/home/bin/x index 0faa918..3961b85 100755 --- a/home/bin/x +++ b/home/bin/x @@ -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 79 | 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";