From b42f9df5d3cc5932e9fc65261b7fd2cb81dd9db9 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 14 Apr 2025 12:33:18 +0400 Subject: [PATCH] pff: support ---clean-switch --- pff | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pff b/pff index 29045d7..e8f35a7 100755 --- a/pff +++ b/pff @@ -1505,10 +1505,17 @@ function list_profiles_cmd() { # pff --switch function switch_cmd() { + local clean= + if [ "$1" == --clean ]; then + shift + clean=1 + fi local profile="$1" pffdir="$2" local -a profiles ensure_pffdir pffdir "$pffdir" + [ -n "$clean" ] && rm -rf "$pffdir/pff/Current" + autoinit "$pffdir" [ -n "$profile" ] || setx profile=get_first_profile "$pffdir" @@ -1842,6 +1849,7 @@ merge_strategy= commit_policy=ask profile= alternate= +clean_switch= args=($parse_mode --help '$exit_with display_help' -0,--init action=init @@ -1867,6 +1875,7 @@ args=($parse_mode --locals action=list-locals --profiles action=list-profiles -s,--switch action=switch + --sk,--clean-switch clean_switch=1 -a,--add-local action=add-local -e,--edit action=edit -p:,--profile: profile= @@ -1888,7 +1897,7 @@ patch) patch_cmd "$merge_strategy" "$commit_policy" "$@";; add-global) add_global_cmd "$@";; list-locals) list_locals_cmd "$@";; list-profiles) list_profiles_cmd "$@";; -switch) switch_cmd "$@";; +switch) switch_cmd ${clean_switch:+--clean} "$@";; add-local) add_local_cmd "$@";; edit) edit_cmd "$profile" "$@";; diff) diff_cmd "$alternate" "$@";;