Compare commits

...

1 Commits

Author SHA1 Message Date
Ismo Vuorinen
b6a18688c4 Fix shfmt command and formatted files 2023-01-12 16:49:49 +02:00
8 changed files with 126 additions and 120 deletions

View File

@@ -115,18 +115,7 @@ function section_dotfiles
;; ;;
shfmt) shfmt)
# Format shell scripts according to following rules. # Format shell scripts according to following rules.
shfmt \ shfmt -fn -l -w -i 2 -ci -sr -bn "$DOTFILES"
--find \
--list \
--write \
--diff \
--simplify \
--indent 2 \
--binary-next-line \
--case-indent \
--space-redirects \
--func-next-line \
"$DOTFILES"
;; ;;
*) *)
menu_section "$USAGE_PREFIX" "link | update | shfmt" menu_section "$USAGE_PREFIX" "link | update | shfmt"

View File

@@ -20,7 +20,8 @@
# #
# Simple function to show usage information, and exit. # Simple function to show usage information, and exit.
# #
usage() { usage()
{
echo "Usage: $0 [-d] [-p 443] domain1.org domain2.com .. domainN" echo "Usage: $0 [-d] [-p 443] domain1.org domain2.com .. domainN"
exit 0 exit 0
} }

View File

@@ -75,7 +75,6 @@ handle_file_ln "$HOME/.dotfiles/config/functions" "$HOME/.config/functions"
handle_file_ln "$HOME/.dotfiles/config/gh/config.yml" "$HOME/.config/gh/config.yml" handle_file_ln "$HOME/.dotfiles/config/gh/config.yml" "$HOME/.config/gh/config.yml"
handle_file_ln "$HOME/.dotfiles/config/git/config" "$HOME/.config/git/config" handle_file_ln "$HOME/.dotfiles/config/git/config" "$HOME/.config/git/config"
handle_file_ln "$HOME/.dotfiles/config/git/gitignore" "$HOME/.config/git/gitignore" handle_file_ln "$HOME/.dotfiles/config/git/gitignore" "$HOME/.config/git/gitignore"
handle_file_ln "$HOME/.dotfiles/config/nvim/after/plugin/defaults.lua" "$HOME/.config/nvim/after/plugin/defaults.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/init.lua" "$HOME/.config/nvim/init.lua" handle_file_ln "$HOME/.dotfiles/config/nvim/init.lua" "$HOME/.config/nvim/init.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/lua/custom/plugins.lua" "$HOME/.config/nvim/lua/custom/plugins.lua" handle_file_ln "$HOME/.dotfiles/config/nvim/lua/custom/plugins.lua" "$HOME/.config/nvim/lua/custom/plugins.lua"
handle_file_ln "$HOME/.dotfiles/config/nvim/plugin/packer_compiled.lua" "$HOME/.config/nvim/plugin/packer_compiled.lua" handle_file_ln "$HOME/.dotfiles/config/nvim/plugin/packer_compiled.lua" "$HOME/.config/nvim/plugin/packer_compiled.lua"

View File

@@ -12,78 +12,95 @@ CLR_BLUE='\033[1;34m'
CLR_RESET="\033[0m" CLR_RESET="\033[0m"
# -- Helpers -- # # -- Helpers -- #
function __log_marker() { function __log_marker()
{
echo -e "${CLR_BLUE}${CLR_RESET}" echo -e "${CLR_BLUE}${CLR_RESET}"
} }
function __log_marker_ok() { function __log_marker_ok()
{
echo -e "${CLR_GREEN}${CLR_RESET}" echo -e "${CLR_GREEN}${CLR_RESET}"
} }
function __log_marker_ok_blue() { function __log_marker_ok_blue()
{
echo -e "${CLR_BLUE}${CLR_RESET}" echo -e "${CLR_BLUE}${CLR_RESET}"
} }
function __log_marker_warn() { function __log_marker_warn()
{
echo -e "${CLR_YELLOW}${CLR_RESET}" echo -e "${CLR_YELLOW}${CLR_RESET}"
} }
function __log_marker_err() { function __log_marker_err()
{
echo -e "${CLR_RED}${CLR_RESET}" echo -e "${CLR_RED}${CLR_RESET}"
} }
function __log_indent() { function __log_indent()
{
echo " " echo " "
} }
# -- Log -- # # -- Log -- #
function msg() { function msg()
{
echo -e "$(__log_marker) $1" echo -e "$(__log_marker) $1"
} }
function msg_done() { function msg_done()
{
echo -e "$(__log_marker) $1 ...$(__log_marker_ok)" echo -e "$(__log_marker) $1 ...$(__log_marker_ok)"
} }
function msg_prompt() { function msg_prompt()
{
echo -e "$(__log_marker) $1" echo -e "$(__log_marker) $1"
} }
function msg_prompt_done() { function msg_prompt_done()
{
echo -e "$(__log_marker) $1 ...$(__log_marker_ok)" echo -e "$(__log_marker) $1 ...$(__log_marker_ok)"
} }
function msg_nested() { function msg_nested()
{
echo -e "$(__log_indent)$(__log_marker) $1" echo -e "$(__log_indent)$(__log_marker) $1"
} }
function msg_nested_done() { function msg_nested_done()
{
echo -e "$(__log_indent)$(__log_marker) $1 ...$(__log_marker_ok)" echo -e "$(__log_indent)$(__log_marker) $1 ...$(__log_marker_ok)"
} }
function msg_run() { function msg_run()
{
echo -e "${CLR_GREEN}$1${CLR_RESET} $2" echo -e "${CLR_GREEN}$1${CLR_RESET} $2"
} }
function msg_ok() { function msg_ok()
{
echo -e "$(__log_marker_ok) $1" echo -e "$(__log_marker_ok) $1"
} }
function msg_warn() { function msg_warn()
{
echo -e "$(__log_marker_warn) $1" echo -e "$(__log_marker_warn) $1"
} }
function msg_err() { function msg_err()
{
echo -e "$(__log_marker_err) $1" echo -e "$(__log_marker_err) $1"
} }
# -- Menu builder -- # # -- Menu builder -- #
function menu_section() { function menu_section()
{
LINE=$(printf '%-18s [ %-15s ]\n' "$1" "$2") LINE=$(printf '%-18s [ %-15s ]\n' "$1" "$2")
echo -e " $(__log_marker) $LINE" echo -e " $(__log_marker) $LINE"
} }
function menu_item() { function menu_item()
{
LINE=$(printf '%-15s %-30s\n' "$1" "$2") LINE=$(printf '%-15s %-30s\n' "$1" "$2")
echo -e "$(__log_indent)$(__log_marker) $LINE" echo -e "$(__log_indent)$(__log_marker) $LINE"
} }