diff options
author | tdro <tdro@users.noreply.github.com> | 2020-11-22 02:54:36 -0500 |
---|---|---|
committer | tdro <tdro@users.noreply.github.com> | 2020-11-22 03:15:30 -0500 |
commit | 1f9dd7aed685437f3f32bd7d6a0081cec1e4ee67 (patch) | |
tree | c32e0b2be2610f72857139a0b3bcfda44f31584a /.local | |
parent | b731c7f1fda2ea099e50956c759fadfe68eeaa42 (diff) | |
download | dotfiles-1f9dd7aed685437f3f32bd7d6a0081cec1e4ee67.tar.gz dotfiles-1f9dd7aed685437f3f32bd7d6a0081cec1e4ee67.tar.bz2 dotfiles-1f9dd7aed685437f3f32bd7d6a0081cec1e4ee67.zip |
.local/bin/plumber-dmenu: Add more plumbers
Dictionary lookup
KJV verse lookup
Diffstat (limited to '.local')
-rwxr-xr-x | .local/bin/plumber | 22 | ||||
-rwxr-xr-x | .local/bin/plumber-dmenu | 2 |
2 files changed, 20 insertions, 4 deletions
diff --git a/.local/bin/plumber b/.local/bin/plumber index 2263105..0fbae36 100755 --- a/.local/bin/plumber +++ b/.local/bin/plumber @@ -8,10 +8,18 @@ defmodule ArgParser do cond do opts[:option] == "First letter of each word in sentence" -> - TextPlumber.firstLetterOfWordsIn(opts[:text]) + TextPlumber.firstLetterOfWordsIn(opts[:text]) |> IO.binwrite() opts[:option] == "Single line of text" -> - TextPlumber.singleLineOf(opts[:text]) + TextPlumber.singleLineOf(opts[:text]) |> IO.binwrite() + + opts[:option] == "Thesaurus" -> + TextPlumber.synonymOfFirstWordIn(opts[:text]) + TextPlumber.firstWordOf(opts[:text]) |> IO.binwrite() + + opts[:option] == "KJV Verse Lookup" -> + System.cmd("urxvt", ["-e", "sh", "-c", "kjv #{TextPlumber.singleLineOf(opts[:text])}"]) + TextPlumber.singleLineOf(opts[:text]) |> IO.binwrite() true -> "No plumber specified #{opts[:option]}" |> IO.puts() @@ -23,13 +31,19 @@ defmodule TextPlumber do def firstLetterOfWordsIn(text) do String.replace(text, ~r/(\w)\w*/, "\\1", global: true) |> String.replace(~r/\s\s+/, " ", global: true) - |> IO.binwrite() end def singleLineOf(text) do String.replace(text, "\n", " ") |> String.replace(~r/\s\s+/, " ", global: true) - |> IO.binwrite() + end + + def firstWordOf(text) do + String.split(text) |> List.first() + end + + def synonymOfFirstWordIn(text) do + System.cmd("urxvt", ["-e", "sh", "-c", "dict #{TextPlumber.firstWordOf(text)} | vim -"]) end end diff --git a/.local/bin/plumber-dmenu b/.local/bin/plumber-dmenu index 9feda59..a4eda59 100755 --- a/.local/bin/plumber-dmenu +++ b/.local/bin/plumber-dmenu @@ -1,6 +1,8 @@ #!/bin/sh -eu options="First letter of each word in sentence Single line of text +Thesaurus +KJV Verse Lookup " printf "%s" "$options" \ | dmenu -i -b \ |