From 0e755d329d23c4d67402c5a1a3357b8c44635171 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Thu, 13 Sep 2018 08:37:11 +0300
Subject: [PATCH] Moved bfg function to shell script, download bfg jar to
 ~/Documents/bin instead of ~/Downloads.

---
 .bashrc           | 5 -----
 Documents/bin/bfg | 6 ++++++
 2 files changed, 6 insertions(+), 5 deletions(-)
 create mode 100755 Documents/bin/bfg

diff --git a/.bashrc b/.bashrc
index 781a730..a413a15 100644
--- a/.bashrc
+++ b/.bashrc
@@ -191,11 +191,6 @@ __sync_comics () {
     find "$HOME/Downloads/Comics/" -name "$(date --date '2 month ago' +'0-Day\ Week\ of\ %Y.%m.*')" -exec rm -r {} +
 }
 
-bfg () {
-    [ -f "$HOME/Downloads/bfg.jar" ] || curl 'https://search.maven.org/remote_content?g=com.madgag&a=bfg&v=LATEST' -sLo "$HOME/Downloads/bfg.jar"
-    java -jar "$HOME/Downloads/bfg.jar" "$@"
-}
-
 ddg () {
     lynx "https://duckduckgo.com/lite/?q=$(urlencode "$@")"
 }
diff --git a/Documents/bin/bfg b/Documents/bin/bfg
new file mode 100755
index 0000000..d5b692f
--- /dev/null
+++ b/Documents/bin/bfg
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -eu
+
+__BFG_JAR="$HOME/Documents/bin/bfg.jar"
+[ -f "$__BFG_JAR" ] || curl 'https://search.maven.org/remote_content?g=com.madgag&a=bfg&v=LATEST' -sLO "$__BFG_JAR"
+exec java -jar "$__BFG_JAR" "$@"
-- 
GitLab