mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 11:14:08 +00:00
feat(dfm): scripts/install-* to autocomplete, docs
This commit is contained in:
@@ -1,6 +1,29 @@
|
||||
#compdef dfm
|
||||
# Completion for dfm, the dotfiles manager
|
||||
|
||||
_dfm() {
|
||||
_dfm_get_script_description() {
|
||||
local file="$1"
|
||||
sed -n '/@description/s/.*@description *\(.*\)/\1/p' "$file" | head -1
|
||||
}
|
||||
|
||||
_dfm_get_available_scripts() {
|
||||
local scripts=()
|
||||
local dotfiles="${HOME}/.dotfiles"
|
||||
|
||||
for script in "${dotfiles}/scripts/install-"*.sh; do
|
||||
if [ -f "$script" ]; then
|
||||
local name=$(basename "$script" .sh | sed 's/install-//')
|
||||
local desc=$(_dfm_get_script_description "$script")
|
||||
[ -z "$desc" ] && desc="No description available"
|
||||
scripts+=("${name}:${desc}")
|
||||
fi
|
||||
done
|
||||
|
||||
echo ${(F)scripts}
|
||||
}
|
||||
|
||||
_dfm()
|
||||
{
|
||||
local -a commands sections
|
||||
|
||||
sections=(
|
||||
@@ -11,6 +34,7 @@ _dfm() {
|
||||
'dotfiles:Dotfiles management commands'
|
||||
'docs:Documentation commands'
|
||||
'helpers:Helper utilities'
|
||||
'scripts:Installation scripts'
|
||||
'tests:Test commands'
|
||||
)
|
||||
|
||||
@@ -129,6 +153,12 @@ _dfm() {
|
||||
_describe 'helper commands' helpers_cmds
|
||||
;;
|
||||
|
||||
scripts)
|
||||
local -a script_cmds
|
||||
script_cmds=("${(@f)$(_dfm_get_available_scripts)}")
|
||||
_describe 'available scripts' script_cmds
|
||||
;;
|
||||
|
||||
tests)
|
||||
local -a test_cmds
|
||||
test_cmds=(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Create file containing key mappings for Neovim
|
||||
# @description Create file containing key mappings for Neovim
|
||||
# Usage: ./create-nvim-keymaps.sh
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Create file containing key mappings for wezterm
|
||||
# @description Create file containing key mappings for wezterm
|
||||
# Usage: ./create-wezterm-keymaps.sh
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install cargo/rust packages.
|
||||
# @description Install cargo/rust packages.
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "$HOME/.dotfiles/config/shared.sh"
|
||||
|
||||
eval "$HOME/.dotfiles/config/shared.sh"
|
||||
|
||||
msg "Starting to install rust/cargo packages"
|
||||
msgr run "Starting to install rust/cargo packages"
|
||||
|
||||
source "$CARGO_HOME/env"
|
||||
|
||||
# If we have cargo install-update, use it first
|
||||
if command -v cargo-install-update &> /dev/null; then
|
||||
msg_run "Updating cargo packages with cargo install-update"
|
||||
msgr run "Updating cargo packages with cargo install-update"
|
||||
cargo install-update -a
|
||||
msg_done "Done with cargo install-update"
|
||||
msgr run_done "Done with cargo install-update"
|
||||
fi
|
||||
|
||||
packages=(
|
||||
@@ -52,8 +51,9 @@ install_packages()
|
||||
# Skip comments
|
||||
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
||||
|
||||
msg_run "Installing cargo package $pkg"
|
||||
msgr run "Installing cargo package $pkg"
|
||||
cargo install --jobs $BUILD_JOBS "$pkg"
|
||||
msgr run_done "Done installing $pkg"
|
||||
echo ""
|
||||
done
|
||||
}
|
||||
@@ -61,14 +61,14 @@ install_packages()
|
||||
# Function to perform additional steps for installed cargo packages
|
||||
post_install_steps()
|
||||
{
|
||||
msg_run "Now doing the next steps for cargo packages"
|
||||
msgr run "Now doing the next steps for cargo packages"
|
||||
|
||||
# use bob to install latest stable nvim
|
||||
if command -v bob &> /dev/null; then
|
||||
bob use stable && x-path-append "$XDG_DATA_HOME/bob/nvim-bin"
|
||||
fi
|
||||
|
||||
msg_run "Removing cargo cache"
|
||||
msgr run "Removing cargo cache"
|
||||
cargo cache --autoclean
|
||||
msg_done "Done removing cargo cache"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# @description Update pure-bash-bible cheatsheets
|
||||
# shellcheck disable=SC2231,SC2034,SC2181,SC2068
|
||||
# shellcheck source=shared.sh
|
||||
source "${DOTFILES}/config/shared.sh"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install PHP Package Manager Composer
|
||||
# @description Install PHP Package Manager Composer
|
||||
#
|
||||
# shellcheck source="shared.sh"
|
||||
source "$HOME/.dotfiles/config/shared.sh"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install NerdFonts
|
||||
# @description Install NerdFonts
|
||||
#
|
||||
# shellcheck source="shared.sh"
|
||||
source "$DOTFILES/config/shared.sh"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install GitHub CLI extensions
|
||||
# @description Install GitHub CLI extensions
|
||||
#
|
||||
# shellcheck source="shared.sh"
|
||||
source "${DOTFILES}/config/shared.sh"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# @description Install git-crypt
|
||||
#
|
||||
# Install git-crypt
|
||||
# NOTE: Experimental, wip
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install Go packages
|
||||
# @description Install Go packages
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "$DOTFILES/config/shared.sh"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Sets macOS Defaults that I like
|
||||
# @description Sets macOS Defaults that I like
|
||||
#
|
||||
# This script contains large portions from following scripts:
|
||||
# - https://github.com/freekmurze/dotfiles/blob/main/macos/set-defaults.sh
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install npm packages globally.
|
||||
# @description Install npm packages globally.
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "$DOTFILES/config/shared.sh"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Install ntfy
|
||||
# @description Install ntfy
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "$DOTFILES/config/shared.sh"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install python/pip packages.
|
||||
# @description Install python/pip packages.
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "${DOTFILES}/config/shared.sh"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install XCode CLI Tools with osascript magic.
|
||||
# @description Install XCode CLI Tools with osascript magic.
|
||||
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
|
||||
#
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install z
|
||||
# @description Install z
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "${DOTFILES}/config/shared.sh"
|
||||
|
||||
Reference in New Issue
Block a user