mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 03:04:06 +00:00
fix(scripts): resolve shellcheck warnings (#148)
This commit is contained in:
2
.github/workflows/linters.yml
vendored
2
.github/workflows/linters.yml
vendored
@@ -33,4 +33,4 @@ jobs:
|
|||||||
|
|
||||||
- name: Run PR Lint
|
- name: Run PR Lint
|
||||||
# https://github.com/ivuorinen/actions
|
# https://github.com/ivuorinen/actions
|
||||||
uses: ivuorinen/actions/pr-lint@625c37446b1c7e219755a40807f825c9283f6e05 # 25.7.7
|
uses: ivuorinen/actions/pr-lint@625c37446b1c7e219755a40807f825c9283f6e05 # 25.7.7
|
||||||
|
|||||||
34
AGENTS.md
Normal file
34
AGENTS.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# Project guidelines
|
||||||
|
|
||||||
|
This repository contains configuration files and helper scripts for managing a development environment. Dotbot drives the installation and host specific folders under `hosts/` include extra configs.
|
||||||
|
|
||||||
|
## Keeping the repository up to date
|
||||||
|
|
||||||
|
1. Update submodules with `git submodule update --remote --merge`.
|
||||||
|
2. Pull the latest changes and run `./install`.
|
||||||
|
3. Run `yarn install` whenever `package.json` changes.
|
||||||
|
|
||||||
|
## Linting and tests
|
||||||
|
|
||||||
|
- Format files with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn fix:prettier
|
||||||
|
yarn fix:markdown
|
||||||
|
```
|
||||||
|
|
||||||
|
- Shell scripts must pass `shellcheck`. Run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
find . -path ./node_modules -prune -o -name '*.sh' -print0 | xargs -0 shellcheck
|
||||||
|
```
|
||||||
|
|
||||||
|
- Execute tests with `yarn test`.
|
||||||
|
|
||||||
|
## Debugging lint issues
|
||||||
|
|
||||||
|
- `yarn lint:prettier` and `yarn lint:markdown` show formatting errors.
|
||||||
|
- Ensure shell scripts have a shebang or `# shellcheck shell=bash` directive.
|
||||||
|
- Consult `.shellcheckrc` for project specific checks.
|
||||||
|
|
||||||
|
Scripts rely on helpers in `config/shared.sh` so they run under Bash, Zsh and Fish by default.
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
### Do not edit. This was autogenerated by 'asdf direnv setup' ###
|
### Do not edit. This was autogenerated by 'asdf direnv setup' ###
|
||||||
|
# shellcheck shell=bash
|
||||||
use_asdf() {
|
use_asdf() {
|
||||||
source_env "$(asdf direnv envrc "$@")"
|
source_env "$(asdf direnv envrc "$@")"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
export OP_PLUGIN_ALIASES_SOURCED=1
|
export OP_PLUGIN_ALIASES_SOURCED=1
|
||||||
alias gh="op plugin run -- gh"
|
alias gh="op plugin run -- gh"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ x-path-prepend()
|
|||||||
local dir=$1
|
local dir=$1
|
||||||
case "$CURRENT_SHELL" in
|
case "$CURRENT_SHELL" in
|
||||||
fish)
|
fish)
|
||||||
set -U fish_user_paths "$dir" $fish_user_paths
|
set -U fish_user_paths "$dir" "$fish_user_paths"
|
||||||
;;
|
;;
|
||||||
sh | bash | zsh)
|
sh | bash | zsh)
|
||||||
PATH="$dir:$PATH"
|
PATH="$dir:$PATH"
|
||||||
@@ -106,7 +106,7 @@ if ! declare -f msg_done > /dev/null; then
|
|||||||
# $1 - message (string)
|
# $1 - message (string)
|
||||||
msg_done()
|
msg_done()
|
||||||
{
|
{
|
||||||
msgr done "$1"
|
msgr "done" "$1"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ install_packages()
|
|||||||
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
||||||
|
|
||||||
msgr 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"
|
msgr run_done "Done installing $pkg"
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
@@ -56,13 +56,13 @@ post_install_steps()
|
|||||||
|
|
||||||
msgr run "Removing cargo cache"
|
msgr run "Removing cargo cache"
|
||||||
cargo cache --autoclean
|
cargo cache --autoclean
|
||||||
msgr done "Done removing cargo cache"
|
msgr "done" "Done removing cargo cache"
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
install_packages
|
install_packages
|
||||||
msgr done "Installed cargo packages!"
|
msgr "done" "Installed cargo packages!"
|
||||||
post_install_steps
|
post_install_steps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ VERBOSE="${VERBOSE:-0}"
|
|||||||
|
|
||||||
# Check if ntfy is already installed
|
# Check if ntfy is already installed
|
||||||
if x-have "ntfy"; then
|
if x-have "ntfy"; then
|
||||||
msgr done "ntfy already installed"
|
msgr "done" "ntfy already installed"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ install_ntfy()
|
|||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
install_ntfy
|
install_ntfy
|
||||||
msgr done "ntfy installation complete"
|
msgr "done" "ntfy installation complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user