mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-18 10:50:31 +00:00
chore(dfm): cleanup, fixes
This commit is contained in:
@@ -4,18 +4,22 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# define default variables
|
# define default variables
|
||||||
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
DFM_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
readonly CMD_DIR="${SCRIPT_DIR}/cmd"
|
readonly DFM_SCRIPT_DIR
|
||||||
readonly LIB_DIR="${SCRIPT_DIR}/lib"
|
readonly DFM_CMD_DIR="${DFM_SCRIPT_DIR}/cmd"
|
||||||
readonly DEFAULT_CONFIG_PATH="$HOME/.config"
|
readonly DFM_LIB_DIR="${DFM_SCRIPT_DIR}/lib"
|
||||||
readonly MAX_RETRIES=3
|
readonly DFM_DEFAULT_CONFIG_PATH="$HOME/.config"
|
||||||
export DEFAULT_INSTALL_DIR="$HOME/.local"
|
export DFM_DEFAULT_CONFIG_PATH
|
||||||
export DEFAULT_VERBOSE=0
|
readonly DFM_MAX_RETRIES=3
|
||||||
export TEMP_DIR=$(mktemp -d)
|
export DFM_MAX_RETRIES
|
||||||
|
export DFM_DEFAULT_INSTALL_DIR="$HOME/.local"
|
||||||
|
export DFM_DEFAULT_VERBOSE=0
|
||||||
|
TEMP_DIR=$(mktemp -d)
|
||||||
|
export TEMP_DIR
|
||||||
|
|
||||||
# Load the common and utility functions from the lib directory.
|
# Load the common and utility functions from the lib directory.
|
||||||
source "${LIB_DIR}/common.sh"
|
source "${DFM_LIB_DIR}/common.sh"
|
||||||
source "${LIB_DIR}/utils.sh"
|
source "${DFM_LIB_DIR}/utils.sh"
|
||||||
|
|
||||||
# Main function for the dfm script.
|
# Main function for the dfm script.
|
||||||
#
|
#
|
||||||
@@ -37,8 +41,8 @@ main()
|
|||||||
shift
|
shift
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
# Näytä komennon saatavilla olevat funktiot
|
# Show the available functions for the command
|
||||||
local cmd_file="${CMD_DIR}/${cmd}.sh"
|
local cmd_file="${DFM_CMD_DIR}/${cmd}.sh"
|
||||||
if [[ -f "$cmd_file" ]]; then
|
if [[ -f "$cmd_file" ]]; then
|
||||||
list::print_group "Available functions for '$cmd'"
|
list::print_group "Available functions for '$cmd'"
|
||||||
list::loop_functions "$cmd_file"
|
list::loop_functions "$cmd_file"
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ lib::error::throw()
|
|||||||
local message=$*
|
local message=$*
|
||||||
|
|
||||||
lib::error "$message"
|
lib::error "$message"
|
||||||
return "${ERROR_CODES[$code_name]}"
|
cleanup "${ERROR_CODES[$code_name]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Logs a message to the console if the current log level is set so that the
|
# Logs a message to the console if the current log level is set so that the
|
||||||
|
|||||||
Reference in New Issue
Block a user