···11function dsh
22- if test (uname) = "Darwin"
33- echo "dsh not supported on macOS!"
44- return 1
55- end
66-72 pushd ~/Documents/workspace
8394 set -l dlib "tools/dlib.sh"
+6-4
.config/fish/functions/sync_file.fish
···2121 end
22222323 if test -f $argv[1]
2424- echo "Copying '$argv[1]' to remote '$argv[2]'"
2525- set -a scp_args "$argv[1]" "$argv[2]:"(pwd)"/$argv[1]"
2424+ set -l dest (dirname "$argv[1]")
2525+ echo "Copying '$argv[1]' to '$argv[2]:$dest'"
2626+ set -a scp_args "$argv[1]" "$argv[2]:"(pwd)"/$dest"
2627 else
2727- echo "Copying file '$argv[2]' from remote '$argv[1]'"
2828- set -a scp_args "$argv[1]:"(pwd)"/$argv[2]" "$argv[2]"
2828+ set -l dest (dirname "$argv[2]")
2929+ echo "Copying from '$argv[1]:$argv[2]' to $dest"
3030+ set -a scp_args "$argv[1]:"(pwd)"/$argv[2]" (dirname "$argv[2]")
2931 end
30323133 scp $scp_args
+8-14
.config/fish/i95_cmake_targets.fish
···1515 set -l build_dir (gbase)"/build"
16161717 vssh "if test -d $build_dir; cd $build_dir && cat i95_cmake_targets.txt; end" | egrep "$search_regex"
1818-1919- # Ripgrep for dumb heuristic:
2020- # rg $rg_opts --glob 'CMakeLists.txt' --replace '$target' -- $search_regex'.*$' (gbase) \
2121- # | string trim -- \
2222- # | string replace '${PROJECT_NAME}' '128T' -- \
2323- # | egrep -v '\$|#.*' # exclude things with unexpanded variables or commented out
2418end
25192626-function __complete_build_opts
2727- set cmd $argv[1]
2828-2020+function __get_build_opts
2921 set build_script (gbase)/tools/env_scripts/build
3022 if ! test -x $build_script
3123 return
3224 end
33253434- set build_opts (
3535- $build_script -h \
2626+ $build_script -h \
3627 | rg $rg_opts --replace '$1' -- '-(\S+)\s+[-].*$' - \
3728 | grep -v '\[|\]' \
3829 | string replace '/' "\n" -- \
3930 | string trim --
4040- )
3131+end
3232+3333+function __complete_build_opts
3434+ set cmd $argv[1]
41354242- for build_opt in $build_opts
3636+ for build_opt in (__get_build_opts)
4337 if string match --quiet "*=*" -- $build_opt
4438 set split_opt (string split "=" $build_opt)
4539 __complete_cmd $cmd --old-option $split_opt[1] -x
···4842 __complete_cmd $cmd --old-option $positive_opt
4943 __complete_cmd $cmd --old-option "no$positive_opt"
5044 else
5151- __complete_cmd $cmd --old-option $build_opt
4545+ __complete_cmd $cmd --old-option "$build_opt"
5246 end
5347 end
5448end
+15-9
.config/yadm/hooks/pre_commit
···1111 exit 0
1212fi
13131414-# shellcheck source=utils.sh
1414+# shellcheck source=../utils.sh
1515source utils.sh
16161717if command -v shellcheck >/dev/null; then
···2121 hooks/*
2222 )
23232424- if ! shellcheck "${SHELLCHECK_SOURCES[@]}"; then
2525- echo "Some files failed the shellcheck linter!"
2626- exit 1
2424+ if ! shellcheck --source-path=SCRIPTDIR "${SHELLCHECK_SOURCES[@]}"; then
2525+ exit_with_error "Some files failed the shellcheck linter!"
2726 fi
2827fi
29283029if command -v code >/dev/null; then
3130 if ! check_vscode_exts &>/dev/null; then
3232- list_vscode_exts >$VSCODE_EXTENSIONS
3333- echo "$VSCODE_EXTENSIONS was out-of-date."
3434- echo "It has been auto-updated, and should be committed."
3535- exit 1
3131+ list_vscode_exts >"$VSCODE_EXTENSIONS"
3232+ exit_with_error \
3333+ "$VSCODE_EXTENSIONS was out-of-date." \
3434+ "It has been auto-updated, and should be committed."
3635 fi
3736fi
38373939-# TODO: convert other scripts to fish instead of bash (except bootstrap)
3838+# Check for unstaged fish changes (typically new functions/completions)
3939+untracked_fish_files=$(yadm ls-files --full-name --exclude-standard --others -- ~/.config/fish)
4040+if [[ $untracked_fish_files ]]; then
4141+ exit_with_error "Untracked files found in ~/.config/fish:" "$untracked_fish_files"
4242+fi
4343+4044fish -c fish_normalize_saved_functions
4545+4646+# TODO: convert other scripts to fish instead of bash (except bootstrap)
+8-4
.config/yadm/utils.sh
···3333 "$@"
3434}
35353636+function exit_with_error() {
3737+ printf "ERROR: "
3838+ printf '%s\n' "$@"
3939+ echo
4040+ exit 1
4141+}
4242+3643function install_vscode_exts() {
3744 xargs printf -- "--install-extension %s " <"$VSCODE_EXTENSIONS" | xargs code
3845 echo
···4855 )
49565057 if [[ -n $UNINSTALLED ]]; then
5151- echo "ERROR: some VSCode extensions were not installed:"
5252- echo "$UNINSTALLED"
5353- echo
5454- return 1
5858+ exit_with_error "Some VSCode extensions were not installed:" "$UNINSTALLED"
5559 fi
56605761 local INSTALLED