aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/plumber
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2020-11-23 02:31:56 -0500
committertdro <tdro@users.noreply.github.com>2020-11-23 02:31:56 -0500
commit33fe558b164c7de6aae7dc85382d8404f274b952 (patch)
tree88e402f82372edfbb5ae0da72e02fad4b43fbfe8 /.local/bin/plumber
parentf52e3543ace4dd512750006631940f77885e1bc4 (diff)
downloaddotfiles-33fe558b164c7de6aae7dc85382d8404f274b952.tar.gz
dotfiles-33fe558b164c7de6aae7dc85382d8404f274b952.tar.bz2
dotfiles-33fe558b164c7de6aae7dc85382d8404f274b952.zip
.local/bin/plumber-dmenu: Reduce start up time
Go back to predefining options
Diffstat (limited to '.local/bin/plumber')
-rwxr-xr-x.local/bin/plumber18
1 files changed, 4 insertions, 14 deletions
diff --git a/.local/bin/plumber b/.local/bin/plumber
index 71a19ad..74a51b1 100755
--- a/.local/bin/plumber
+++ b/.local/bin/plumber
@@ -6,31 +6,21 @@ 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] == options |> Enum.at(0) ->
+ opts[:option] == "First letter of each word in sentence" ->
TextPlumber.firstLetterOfWordsIn(opts[:text]) |> IO.binwrite()
- opts[:option] == options |> Enum.at(1) ->
+ opts[:option] == "Single line of text" ->
TextPlumber.singleLineOf(opts[:text]) |> IO.binwrite()
- opts[:option] == options |> Enum.at(2) ->
+ opts[:option] == "Thesaurus" ->
TextPlumber.synonymOfFirstWordIn(opts[:text])
TextPlumber.firstWordOf(opts[:text]) |> IO.binwrite()
- opts[:option] == options |> Enum.at(3) ->
+ opts[:option] == "KJV Verse Lookup" ->
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 #{opts[:option] || "specified"}." |> IO.puts()
end