From 5bdc873d47fad902b4e7fc61523ad9f7ce8a53b1 Mon Sep 17 00:00:00 2001 From: fbt Date: Fri, 31 Aug 2018 05:42:43 +0300 Subject: [PATCH] restructure Signed-off-by: fbt --- le | 2 +- lib/util | 17 +++++++++++++++++ sub/issue | 16 +--------------- sub/renew | 16 +--------------- 4 files changed, 20 insertions(+), 31 deletions(-) create mode 100644 lib/util diff --git a/le b/le index 26ff0c6..a33486a 100755 --- a/le +++ b/le @@ -2,4 +2,4 @@ subcommand=$1; shift -source "sub/$subcommand" "$@" +"sub/$subcommand" "$@" diff --git a/lib/util b/lib/util new file mode 100644 index 0000000..c04c25b --- /dev/null +++ b/lib/util @@ -0,0 +1,17 @@ +#!syntax bash + +err() { + printf '%s\n' "$*" >&2 +} + +msg() { + printf '%s\n' "$*" +} + +set_default() { + declare -n _vref=$1 + + if ! [[ "$_vref" ]]; then + _vref=$2 + fi +} diff --git a/sub/issue b/sub/issue index e1ff8e5..91574fb 100755 --- a/sub/issue +++ b/sub/issue @@ -1,20 +1,6 @@ #!/usr/bin/env bash -err() { - printf '%s\n' "$*" >&2 -} - -msg() { - printf '%s\n' "$*" -} - -set_default() { - declare -n _vref=$1 - - if ! [[ "$_vref" ]]; then - _vref=$2 - fi -} +source lib/util gen_san_string() { declare d diff --git a/sub/renew b/sub/renew index 8ccf9b5..561f2a8 100755 --- a/sub/renew +++ b/sub/renew @@ -1,20 +1,6 @@ #!/usr/bin/env bash -err() { - printf '%s\n' "$*" >&2 -} - -msg() { - printf '%s\n' "$*" -} - -set_default() { - declare -n _vref=$1 - - if ! [[ "$_vref" ]]; then - _vref=$2 - fi -} +source lib/util usage() { while read -r line; do printf '%s\n' "$line"; done <<- EOF