diff options
author | tdro <tdro@users.noreply.github.com> | 2021-06-28 17:49:13 -0400 |
---|---|---|
committer | tdro <tdro@users.noreply.github.com> | 2021-06-28 17:49:13 -0400 |
commit | b36aca76aca5eeb35a97a1437f8c60b460ed2a60 (patch) | |
tree | 92a0cf8590eff36890b1fed41ee116e7ee1775b0 | |
parent | 7ebe6507251b80b8e207d5d7de4af17c4c94c10f (diff) | |
download | dotfiles-b36aca76aca5eeb35a97a1437f8c60b460ed2a60.tar.gz dotfiles-b36aca76aca5eeb35a97a1437f8c60b460ed2a60.tar.bz2 dotfiles-b36aca76aca5eeb35a97a1437f8c60b460ed2a60.zip |
.local/bin/plumber: Add slug and lower case
-rwxr-xr-x | .local/bin/plumber | 21 | ||||
-rwxr-xr-x | .local/bin/plumber-dmenu | 2 |
2 files changed, 22 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() diff --git a/.local/bin/plumber-dmenu b/.local/bin/plumber-dmenu index bdfe28e..850b76e 100755 --- a/.local/bin/plumber-dmenu +++ b/.local/bin/plumber-dmenu @@ -4,6 +4,8 @@ Single line of text Thesaurus KJV Verse Lookup Title Case +Slug +Lower Case " printf "%s" "$options" \ | dmenu -i -b -p Plumb \ |