mirror of
https://github.com/edu4rdshl/based.fish.git
synced 2026-07-17 23:24:46 +00:00
(feat): add BASED_EXCLUDED_PATHS to exclude directories from history
There are cases where you want to exclude some paths from being indexed. E.g: `..`, `/tmp/*`, and others.
This commit is contained in:
parent
0206728145
commit
2afe4b3aba
3 changed files with 11 additions and 0 deletions
|
|
@ -3,4 +3,5 @@ complete -c based -n __fish_use_subcommand -f -a init -d "Initialize the Based d
|
||||||
complete -c based -n __fish_use_subcommand -f -a import -d "Import Fish history into Based"
|
complete -c based -n __fish_use_subcommand -f -a import -d "Import Fish history into Based"
|
||||||
complete -c based -n __fish_use_subcommand -f -a stats -d "Show Based statistics"
|
complete -c based -n __fish_use_subcommand -f -a stats -d "Show Based statistics"
|
||||||
complete -c based -n __fish_use_subcommand -f -a reset -d "Reset Based state"
|
complete -c based -n __fish_use_subcommand -f -a reset -d "Reset Based state"
|
||||||
|
complete -c based -n __fish_use_subcommand -f -a maintenance -d "Perform database maintenance"
|
||||||
complete -c based -n __fish_use_subcommand -f -a help -d "Show help message"
|
complete -c based -n __fish_use_subcommand -f -a help -d "Show help message"
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,15 @@ function __based_log --on-event fish_preexec
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Check if path should be excluded
|
||||||
|
if set -q BASED_EXCLUDED_PATHS
|
||||||
|
for excluded_pattern in $BASED_EXCLUDED_PATHS
|
||||||
|
if string match -q $excluded_pattern $path
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
set cmd (string replace -a "'" "''" -- $cmd)
|
set cmd (string replace -a "'" "''" -- $cmd)
|
||||||
set path (string replace -a "'" "''" -- $path)
|
set path (string replace -a "'" "''" -- $path)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,6 @@ function __based_reset_state
|
||||||
# Unset all variables related to Based state
|
# Unset all variables related to Based state
|
||||||
set -e BASED_NO_CONFIRMATION
|
set -e BASED_NO_CONFIRMATION
|
||||||
set -e BASED_NO_FUZZY
|
set -e BASED_NO_FUZZY
|
||||||
|
set -e BASED_EXCLUDED_PATHS
|
||||||
echo "Based state has been reset."
|
echo "Based state has been reset."
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue