AutoYADM commit: 2025-07-18 17:04:43

This commit is contained in:
Daniel Fichtinger 2025-07-18 17:04:43 -04:00
parent b793e169aa
commit 8f2f9512e7

View file

@ -2,6 +2,7 @@ provide-module root %∴
declare-option str-list root_globs .git .kakrc kakrc declare-option str-list root_globs .git .kakrc kakrc
declare-option str root_path %sh{ echo "$PWD" } declare-option str root_path %sh{ echo "$PWD" }
declare-option -hidden str root_prev_pwd %opt{root_path} declare-option -hidden str root_prev_pwd %opt{root_path}
# recursively discovers the root dir based on root_globs
define-command root-discover %{ define-command root-discover %{
evaluate-commands %sh{ evaluate-commands %sh{
globs="$kak_opt_root_globs" globs="$kak_opt_root_globs"
@ -37,36 +38,26 @@ provide-module root %∴
change-directory %opt{root_path} change-directory %opt{root_path}
echo "CWD: %opt{root_path}" echo "CWD: %opt{root_path}"
} }
# TODO: return aint workin
define-command -hidden root-cd-return-impl %{ define-command -hidden root-cd-return-impl %{
change-directory %opt{root_prev_pwd} change-directory %opt{root_prev_pwd}
echo "CWD: %opt{root_prev_pwd}" echo "CWD: %opt{root_prev_pwd}"
} }
define-command root-cd %sh{ define-command root-cd %{
evaluate-commands %sh{
if [ "$PWD" != "$kak_opt_root_path" ]; then if [ "$PWD" != "$kak_opt_root_path" ]; then
echo "root-cd-root-impl" echo "root-cd-root-impl"
else else
echo "root-cd-return-impl" echo "root-cd-return-impl"
fi fi
} }
}
define-command -params 1 root-edit %{ define-command -params 1 root-edit %{
edit %exp{%opt{root_path}/%arg{1}} edit %exp{%opt{root_path}/%arg{1}}
} }
define-command just %{ alias global re root-edit
root-edit justfile
}
define-command pyproject %{
root-edit pyproject.toml
}
define-command readme %{
root-edit README.md
}
define-command kakrc %{
root-edit .kakrc
}