commit ebec6d5329ef1cb01fffe023896204c6a5166dba
parent ba906422520d1a78e326e05d61f021fbfc57cfce
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Sat, 13 Feb 2021 15:31:33 -0800
Rename and revise the fl script
Using dmenu(1) for selection greatly simplifies the task of the
script making it short and more functional. While the new name,
open, is not great it's better than fl in my opinion.
It is now written in sh(1) instead of rc(1) for portability since
there isn't anything to this script anyway.
Diffstat:
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/modules/scripts/.local/bin/fl b/modules/scripts/.local/bin/fl
@@ -1,13 +0,0 @@
-#!/usr/local/bin/rc -e
-#! fl -- open locate(1)'s findings in EDITOR
-
-# A flaw of this method is that you cannot anchor the match.
-match = `{ locate $* }
-
-if (test $#match -eq 0) {
- if (test -n $match) {
- $EDITOR $match
- }
-} else {
- echo $match
-}
diff --git a/modules/scripts/.local/bin/open b/modules/scripts/.local/bin/open
@@ -0,0 +1,9 @@
+#!/bin/sh
+# Copywrite 2021 Jacob R. Edwards
+# License: GPLv3
+#
+# open -- edit locate(1)'s findings, selected by dmenu(1)
+
+IFS='
+'
+paths=`locate ${*:-''} | dmenu` && exec ${EDITOR:-vi} $paths