aboutsummaryrefslogtreecommitdiff
path: root/Scripts/.local/scripts/qedit
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/.local/scripts/qedit')
-rwxr-xr-xScripts/.local/scripts/qedit25
1 files changed, 25 insertions, 0 deletions
diff --git a/Scripts/.local/scripts/qedit b/Scripts/.local/scripts/qedit
new file mode 100755
index 0000000..44cfa18
--- /dev/null
+++ b/Scripts/.local/scripts/qedit
@@ -0,0 +1,25 @@
+#!/usr/bin/env sh
+
+if [ $# -eq 0 ] || [ $# -gt 2 ]
+then
+ printf "Usage: $0 <extension> [editor]\n"
+ exit 1
+fi
+
+name=$(mktemp --suffix=".$1")
+editor=""
+
+if [ $# -eq 1 ]
+then
+ if [ -z "$EDITOR" ]
+ then
+ editor="vim";
+ else
+ editor="$EDITOR";
+ fi
+elif [ $# -eq 2 ]
+then
+ editor="$2"
+fi
+
+$editor $name