aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/add-new.sh9
-rwxr-xr-xbin/migrate.sh13
2 files changed, 20 insertions, 2 deletions
diff --git a/bin/add-new.sh b/bin/add-new.sh
index c82bc70..086cff8 100755
--- a/bin/add-new.sh
+++ b/bin/add-new.sh
@@ -1,5 +1,10 @@
#!/bin/bash
export NEWS_FILE="$(date +%Y%m%d_%H%M%S)"
vi $NEWS_FILE
-git add $NEWS_FILE
-git commit -m "$(head -n 1 $NEWS_FILE)"
+echo "Renaming..."
+TITLE="$(head -n 1 $NEWS_FILE)"
+TO_FILE=$NEWS_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' )
+mv $NEWS_FILE $TO_FILE
+echo "Adding to git repo..."
+git add $TO_FILE
+git commit -m "Added $NEWS_FILE with $(head -n 1 $TO_FILE)"
diff --git a/bin/migrate.sh b/bin/migrate.sh
new file mode 100755
index 0000000..8b6db20
--- /dev/null
+++ b/bin/migrate.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+echo "Migration tool: please run only once"
+FILES=$(ls -1 | grep 202)
+for file in $FILES; do
+ if [ -f $file ]
+ then
+ title="$(head -n 1 $file)"
+ new_name="$file-$(echo "$title" | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g')"
+ mv $file $new_name
+ git add $file $new_name
+ git commit -m "Migrated to new naming $file to $new_name";
+ fi
+done