aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2020-11-23 00:09:25 -0500
committertdro <tdro@users.noreply.github.com>2020-11-23 00:09:25 -0500
commit7b840fa8572c64f4a75ecf6bb70a2d868de782f5 (patch)
tree82fce68945b1e997a52840a6a9a7e4008f2e9403 /.local
parent0afb5d636e989f16521d74775cbfb527f9675bd3 (diff)
downloaddotfiles-7b840fa8572c64f4a75ecf6bb70a2d868de782f5.tar.gz
dotfiles-7b840fa8572c64f4a75ecf6bb70a2d868de782f5.tar.bz2
dotfiles-7b840fa8572c64f4a75ecf6bb70a2d868de782f5.zip
.local/bin/plumber-dmenu: Get options from plumber
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/plumber20
-rwxr-xr-x.local/bin/plumber-dmenu7
2 files changed, 16 insertions, 11 deletions
diff --git a/.local/bin/plumber b/.local/bin/plumber
index 0fbae36..71a19ad 100755
--- a/.local/bin/plumber
+++ b/.local/bin/plumber
@@ -6,23 +6,33 @@ defmodule ArgParser do
System.argv()
|> OptionParser.parse!(strict: [option: :string, text: :string])
+ options = [
+ "First letter of each word in sentence", #0
+ "Single line of text", #1
+ "Thesaurus", #2
+ "KJV Verse Lookup" #3
+ ]
+
cond do
- opts[:option] == "First letter of each word in sentence" ->
+ opts[:option] == options |> Enum.at(0) ->
TextPlumber.firstLetterOfWordsIn(opts[:text]) |> IO.binwrite()
- opts[:option] == "Single line of text" ->
+ opts[:option] == options |> Enum.at(1) ->
TextPlumber.singleLineOf(opts[:text]) |> IO.binwrite()
- opts[:option] == "Thesaurus" ->
+ opts[:option] == options |> Enum.at(2) ->
TextPlumber.synonymOfFirstWordIn(opts[:text])
TextPlumber.firstWordOf(opts[:text]) |> IO.binwrite()
- opts[:option] == "KJV Verse Lookup" ->
+ opts[:option] == options |> Enum.at(3) ->
System.cmd("urxvt", ["-e", "sh", "-c", "kjv #{TextPlumber.singleLineOf(opts[:text])}"])
TextPlumber.singleLineOf(opts[:text]) |> IO.binwrite()
+ opts[:option] == "list" ->
+ Enum.map(options, fn option -> IO.puts(option) end)
+
true ->
- "No plumber specified #{opts[:option]}" |> IO.puts()
+ "No plumber #{opts[:option] || "specified"}." |> IO.puts()
end
end
end
diff --git a/.local/bin/plumber-dmenu b/.local/bin/plumber-dmenu
index a4eda59..46dae74 100755
--- a/.local/bin/plumber-dmenu
+++ b/.local/bin/plumber-dmenu
@@ -1,10 +1,5 @@
#!/bin/sh -eu
-options="First letter of each word in sentence
-Single line of text
-Thesaurus
-KJV Verse Lookup
-"
-printf "%s" "$options" \
+plumber --option list \
| dmenu -i -b \
| while read -r option
do