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