chore(dfm): cleanup, fixes

This commit is contained in:
2025-02-25 23:49:22 +02:00
parent 255c8fdce7
commit 359ac4e2c0
3 changed files with 60 additions and 14 deletions

View File

@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Installation functions for dfm, the dotfile manager
#
# @author Ismo Vuorinen <https://github.com/ivuorinen>
@@ -9,7 +10,7 @@ function all()
lib::log "Installing all packages..."
fonts
brew
asdf
cargo
}
# @description Install fonts
@@ -19,15 +20,6 @@ function fonts()
# implement fonts installation
}
# Install asdf and set it up.
#
# @description Install asdf
function asdf()
{
lib::log "Installing asdf..."
# implement asdf installation
}
# Install Homebrew and set it up.
#
# @description Installs Homebrew
@@ -36,3 +28,10 @@ function brew()
lib::log "Installing Homebrew..."
# implement Homebrew installation
}
# @description Install Rust and cargo packages.
function cargo()
{
lib::log "Installing Rust and cargo packages..."
# implement Rust and cargo packages installation
}

View File

@@ -65,16 +65,16 @@ lib::error::handle()
local command=$2
case $exit_code in
${ERROR_CODES[INVALID_ARGUMENT]})
"${ERROR_CODES[INVALID_ARGUMENT]}")
lib::error "Invalid argument at line $line_no in command '$command'"
;;
${ERROR_CODES[COMMAND_NOT_FOUND]})
"${ERROR_CODES[COMMAND_NOT_FOUND]}")
lib::error "Command not found at line $line_no"
;;
${ERROR_CODES[FUNCTION_NOT_FOUND]})
"${ERROR_CODES[FUNCTION_NOT_FOUND]}")
lib::error "Function not found at line $line_no in command '$command'"
;;
${ERROR_CODES[EXECUTION_FAILED]})
"${ERROR_CODES[EXECUTION_FAILED]}")
lib::error "Execution failed at line $line_no in command '$command'"
;;
*)

View File

@@ -23,6 +23,52 @@ readonly MAGENTA="\033[35m"
readonly CYAN="\033[36m"
readonly WHITE="\033[37m"
clr::black()
{
printf "${BLACK}%s${RESET}" "$*"
}
clr::red()
{
printf "${RED}%s${RESET}" "$*"
}
clr::green()
{
printf "${GREEN}%s${RESET}" "$*"
}
clr::yellow()
{
printf "${YELLOW}%s${RESET}" "$*"
}
clr::blue()
{
printf "${BLUE}%s${RESET}" "$*"
}
clr::magenta()
{
printf "${MAGENTA}%s${RESET}" "$*"
}
clr::white()
{
printf "${WHITE}%s${RESET}" "$*"
}
style::bold()
{
printf "${BOLD}%s${RESET}" "$*"
}
style::dim()
{
printf "${DIM}%s${RESET}" "$*"
}
style::italic()
{
printf "${ITALIC}%s${RESET}" "$*"
}
style::underline()
{
printf "${UNDERLINE}%s${RESET}" "$*"
}
# Function to print formatted line
list::print_formatted()
{
@@ -321,6 +367,7 @@ main::execute_command()
fi
# Source the command file
# shellcheck source=/dev/null
source "$cmd_file"
# Check if the function exists