fix(fastfile): fix multiple bugs in plugin (#9574)

- `fastfile_sync` didn't correctly create the aliases
- `fastfile_rm` didn't correctly remove the alias

Fixes #9151
Closes #9574
This commit is contained in:
Shundeev Egor
2021-01-05 19:46:05 +03:00
committed by Marc Cornellà
parent 0613232202
commit 79cf2a0d43
2 changed files with 15 additions and 13 deletions

View File

@@ -44,7 +44,7 @@ function fastfile() {
# The path to the shortcut file
#
function fastfile_resolv() {
echo "${fastfile_dir}${1}"
echo "${fastfile_dir}/${1}"
}
#
@@ -78,9 +78,9 @@ function fastfile_print() {
# (=> fastfile_print) for each shortcut
#
function fastfile_ls() {
for f in "${fastfile_dir}"/*(NF); do
file=`basename "$f"` # To enable simpler handling of spaces in file names
varkey=`echo "$file" | tr " " "_"`
for f in "${fastfile_dir}"/*(N); do
file=$(basename "$f") # To enable simpler handling of spaces in file names
varkey=$(echo "$file" | tr " " "_")
# Special format for columns
echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
@@ -98,15 +98,16 @@ function fastfile_ls() {
function fastfile_rm() {
fastfile_print "$1"
rm "$(fastfile_resolv "$1")"
unalias "${fastfile_var_prefix}${1}"
}
#
# Generate the aliases for the shortcuts
#
function fastfile_sync() {
for f in "${fastfile_dir}"/*(NF); do
file=`basename "$f"` # To enable simpler handling of spaces in file names
varkey=`echo "$file" | tr " " "_"`
for f in "${fastfile_dir}"/*(N); do
file=$(basename "$f") # To enable simpler handling of spaces in file names
varkey=$(echo "$file" | tr " " "_")
alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
done