From 3690e80787227651b5d47add3c823014318bb365 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Sun, 11 Sep 2022 11:13:59 -0400 Subject: [PATCH] Allow anonymous experiments --- home/bin/x | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/home/bin/x b/home/bin/x index eb5aee2..1b04be6 100755 --- a/home/bin/x +++ b/home/bin/x @@ -3,20 +3,13 @@ set -e; name=$(echo "$@" | sed 's/\s\+/-/g'); - -if [ "$name" != "" ]; -then - timestamp=$(date +'%F--%H-%M-%S'); - directory="$HOME/x/$timestamp--$name"; - mkdir -p "$directory"; - cd "$directory"; - printf '# %s\n' "$name" > README; - git init >&2 - git commit --allow-empty -m 'Root commit' >&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; +timestamp=$(date +'%F--%H-%M-%S'); +directory="$HOME/x/$timestamp--$name"; +mkdir -p "$directory"; +cd "$directory"; +printf '# %s\n' "$name" > README; +git init >&2 +git commit --allow-empty -m 'Root commit' >&2 +git add . >&2 +git commit -m 'Initial commit' >&2 +echo "$directory"; -- 2.20.1