aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/plumber
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/bin/plumber
parent608ac8edc9a90d1ddeb8de5e005377ba851089ad (diff)
downloaddotfiles-06857c7b2d58a9f08a1cdd4094a70ca5ed8d6bac.tar.gz
dotfiles-06857c7b2d58a9f08a1cdd4094a70ca5ed8d6bac.tar.bz2
dotfiles-06857c7b2d58a9f08a1cdd4094a70ca5ed8d6bac.zip
.local/bin/plumber: Add title case
Diffstat (limited to '.local/bin/plumber')
-rwxr-xr-x.local/bin/plumber7
1 files changed, 7 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