aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2020-11-23 19:43:06 -0500
committertdro <tdro@users.noreply.github.com>2020-11-23 19:43:06 -0500
commit06857c7b2d58a9f08a1cdd4094a70ca5ed8d6bac (patch)
tree6e8a58439aa7ebe6978146d9e0cbc42a6d174de9 /.local
parent608ac8edc9a90d1ddeb8de5e005377ba851089ad (diff)
downloaddotfiles-06857c7b2d58a9f08a1cdd4094a70ca5ed8d6bac.tar.gz
dotfiles-06857c7b2d58a9f08a1cdd4094a70ca5ed8d6bac.tar.bz2
dotfiles-06857c7b2d58a9f08a1cdd4094a70ca5ed8d6bac.zip
.local/bin/plumber: Add title case
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/plumber7
-rwxr-xr-x.local/bin/plumber-dmenu1
2 files changed, 8 insertions, 0 deletions
diff --git a/.local/bin/plumber b/.local/bin/plumber
index 74a51b1..b791adc 100755
--- a/.local/bin/plumber
+++ b/.local/bin/plumber
@@ -21,6 +21,9 @@ defmodule ArgParser do
System.cmd("urxvt", ["-e", "sh", "-c", "kjv #{TextPlumber.singleLineOf(opts[:text])}"])
TextPlumber.singleLineOf(opts[:text]) |> IO.binwrite()
+ opts[:option] == "Title Case" ->
+ TextPlumber.titleCaseOf(opts[:text]) |> IO.binwrite()
+
true ->
"No plumber #{opts[:option] || "specified"}." |> IO.puts()
end
@@ -42,6 +45,10 @@ defmodule TextPlumber do
String.split(text) |> List.first()
end
+ def titleCaseOf(text) do
+ text |> String.split() |> Enum.map(fn word -> :string.titlecase(word) end) |> Enum.join(" ")
+ end
+
def synonymOfFirstWordIn(text) do
System.cmd("urxvt", ["-e", "sh", "-c", "dict #{TextPlumber.firstWordOf(text)} | vim -"])
end
diff --git a/.local/bin/plumber-dmenu b/.local/bin/plumber-dmenu
index d7ece41..bdfe28e 100755
--- a/.local/bin/plumber-dmenu
+++ b/.local/bin/plumber-dmenu
@@ -3,6 +3,7 @@ options="First letter of each word in sentence
Single line of text
Thesaurus
KJV Verse Lookup
+Title Case
"
printf "%s" "$options" \
| dmenu -i -b -p Plumb \