From e957c907a2e9d9d7220cc64c5acbef304bca5cef Mon Sep 17 00:00:00 2001 From: tdro Date: Tue, 10 May 2022 02:52:16 -0400 Subject: .local/bin/plumber: Add 8601 dates --- .local/bin/plumber | 34 ++++++++++++++++++++++++---------- .local/bin/plumber-dmenu | 1 + 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.local/bin/plumber b/.local/bin/plumber index 4483708..e2c9911 100755 --- a/.local/bin/plumber +++ b/.local/bin/plumber @@ -13,16 +13,17 @@ defmodule ArgParser do |> OptionParser.parse!(strict: [option: :string, text: :string]) options = [ - camelize: "text->camelize", - dictionary: "word->dictionary", - first_letter: "text->first-letter-words", - kjv_lookup: "verse->kjv", - lorem_paragraph: "lorem->paragraph", - lorem_title: "lorem->title", - lower_case: "case->lower", - single_line: "text->single-line", - slugize: "text->slugize", - title_case: "case->title", + camelize: "text->camelize", + date8601: "text->date8601", + dictionary: "word->dictionary", + first_letter: "text->first-letter-words", + kjv_lookup: "verse->kjv", + lorem_paragraph: "lorem->paragraph", + lorem_title: "lorem->title", + lower_case: "case->lower", + single_line: "text->single-line", + slugize: "text->slugize", + title_case: "case->title", title_case_strict: "case->title-strict" ] @@ -73,6 +74,9 @@ defmodule ArgParser do opts[:option] == options[:lorem_paragraph] -> TextPlumber.loremParagraph() + opts[:option] == options[:date8601] -> + TextPlumber.date8601() + opts[:option] == options[:kjv_lookup] -> System.cmd(Settings.terminal(), [ "-e", @@ -136,6 +140,16 @@ defmodule TextPlumber do "dict -h localhost #{TextPlumber.firstWordOf(text)} 2>&1 | vim -" ]) end + + def date8601() do + {string, _return} = + System.cmd("date", [ + "--universal", + "--iso-8601=seconds" + ]) + + IO.puts(string) + end end ArgParser.parse() diff --git a/.local/bin/plumber-dmenu b/.local/bin/plumber-dmenu index 07e0488..262d099 100755 --- a/.local/bin/plumber-dmenu +++ b/.local/bin/plumber-dmenu @@ -1,6 +1,7 @@ #!/bin/sh -eu options="\ text->camelize +text->date8601 word->dictionary text->first-letter-words verse->kjv -- cgit v1.2.3