aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/plumber
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2021-06-28 17:49:13 -0400
committertdro <tdro@users.noreply.github.com>2021-06-28 17:49:13 -0400
commitb36aca76aca5eeb35a97a1437f8c60b460ed2a60 (patch)
tree92a0cf8590eff36890b1fed41ee116e7ee1775b0 /.local/bin/plumber
parent7ebe6507251b80b8e207d5d7de4af17c4c94c10f (diff)
downloaddotfiles-b36aca76aca5eeb35a97a1437f8c60b460ed2a60.tar.gz
dotfiles-b36aca76aca5eeb35a97a1437f8c60b460ed2a60.tar.bz2
dotfiles-b36aca76aca5eeb35a97a1437f8c60b460ed2a60.zip
.local/bin/plumber: Add slug and lower case
Diffstat (limited to '.local/bin/plumber')
-rwxr-xr-x.local/bin/plumber21
1 files changed, 20 insertions, 1 deletions
diff --git a/.local/bin/plumber b/.local/bin/plumber
index b555456..99cc7f3 100755
--- a/.local/bin/plumber
+++ b/.local/bin/plumber
@@ -17,7 +17,9 @@ defmodule ArgParser do
title_case: "Title Case",
kjv_lookup: "KJV Verse Lookup",
single_line: "Single line of text",
- first_letter: "First letter of each word in sentence"
+ first_letter: "First letter of each word in sentence",
+ slug_text: "Slug",
+ lower_case: "Lower Case"
]
cond do
@@ -44,6 +46,15 @@ defmodule ArgParser do
opts[:option] == options[:title_case] ->
TextPlumber.titleCaseOf(opts[:text]) |> IO.binwrite()
+ opts[:option] == options[:title_case] ->
+ TextPlumber.titleCaseOf(opts[:text]) |> IO.binwrite()
+
+ opts[:option] == options[:slug_text] ->
+ TextPlumber.lowerCaseOf(opts[:text]) |> TextPlumber.slugOf() |> IO.binwrite()
+
+ opts[:option] == options[:lower_case] ->
+ TextPlumber.lowerCaseOf(opts[:text]) |> IO.binwrite()
+
true ->
Enum.each(options, fn {_, value} -> IO.puts(value) end)
end
@@ -77,6 +88,14 @@ defmodule TextPlumber do
"dict -h localhost #{TextPlumber.firstWordOf(text)} 2>&1 | vim -"
])
end
+
+ def slugOf(text) do
+ String.replace(text, " ", "-")
+ end
+
+ def lowerCaseOf(text) do
+ String.downcase(text)
+ end
end
ArgParser.parse()