Skip to content

Commit

Permalink
Hugo completion in main script, remove default dotfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
fortes committed Jan 31, 2024
1 parent 11ae1f4 commit 3e1e6de
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 24 deletions.
1 change: 1 addition & 0 deletions scripts/brew-packages
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ git-extras
git-lfs
helix
htop
hugo
jq
keychain
mpv
Expand Down
10 changes: 9 additions & 1 deletion scripts/generate_completions
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ source "${HOME}/dotfiles/stowed-files/bash/.profile"

generate_completions() {
declare -r completion_dir="$HOME/.local/completion.d"
echo -n "… Generating completions & man pages"
declare -r man_dir_path="$HOME/.local/share/man/man1"
mkdir -p "${completion_dir}"
mkdir -p "${man_dir_path}"

echo -n "… Generating completions & man pages"

if command_exists npm; then
npm completion > "${completion_dir}/npm_completion"
Expand All @@ -24,6 +27,11 @@ generate_completions() {
gh completion -s bash > "${completion_dir}/gh_completion"
fi

if command_exists hugo; then
hugo completion bash > "${completion_dir}/hugo_completion"
hugo gen man --dir "${man_dir_path}" > /dev/null
fi

if command_exists pipx; then
register-python-argcomplete --shell bash pipx > "${completion_dir}/pipx_completion"
fi
Expand Down
11 changes: 0 additions & 11 deletions scripts/install_github_packages
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,6 @@ install_helix() {

install_hugo() {
install_deb 'gohugoio/hugo' 'hugo_extended_.*_linux-amd64.deb'

echo "Generating hugo bash completion & man pages"
mkdir -p "$HOME/.local/completion.d"
hugo completion bash > "$HOME/.local/completion.d/hugo_completion"
pushd "$(mktemp -d)" > /dev/null
hugo gen man
local man_dir_path="$HOME/.local/share/man/man1"
mkdir -p "${man_dir_path}"
mv man/* "${man_dir_path}"
popd > /dev/null
rm -rf "${man_dir_path}"
}

install_lazydocker() {
Expand Down
4 changes: 4 additions & 0 deletions scripts/setup_mac
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ main() {
install_homebrew
install_homebrew_packages

# Remove default files before stowing, otherwise stow fails
"${dotfiles_root}/scripts/remove_default_dotfiles"
"${dotfiles_root}/scripts/stow"

setup_shell
Expand All @@ -95,6 +97,8 @@ main() {

"${dotfiles_root}/scripts/generate_completions"

# TODO: Neovim plugin install?

echo "Setup complete!"
}

Expand Down
14 changes: 2 additions & 12 deletions scripts/setup_machine
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,6 @@ is_package_installed() {
fi
}

remove_default_dotfile() {
declare -r filename=$1
if [[ -f "$HOME/$filename" && ! -L "$HOME/$filename" ]]; then
echo "Moving default $filename"
mv "$HOME/$filename" "$HOME/original$filename"
fi
}

set_default_applications() {
if command_exists nvim && ! update-alternatives --query editor | grep ^Value | grep -q nvim; then
echo "Setting Neovim as default text editor (requires sudo)"
Expand Down Expand Up @@ -285,10 +277,8 @@ main() {
[[ -z "${IS_HEADLESS:-}" ]] && "${dotfiles_root}/scripts/install_firefox"
"${dotfiles_root}/scripts/install_github_packages"

# Debian ships with these two by default
remove_default_dotfile .bashrc
remove_default_dotfile .profile

# Remove default files before stowing, otherwise stow fails
"${dotfiles_root}/scripts/remove_default_dotfiles"
"${dotfiles_root}/scripts/stow"

# Misc system configs
Expand Down

0 comments on commit 3e1e6de

Please sign in to comment.