X-Git-Url: https://src.twobees.de/?a=blobdiff_plain;f=stow%2Foh-my-zsh%2F.oh-my-zsh%2Fplugins%2Ffastfile%2Ffastfile.plugin.zsh;fp=stow%2Foh-my-zsh%2F.oh-my-zsh%2Fplugins%2Ffastfile%2Ffastfile.plugin.zsh;h=0000000000000000000000000000000000000000;hb=1a8e170bbe5c6641a26ab1ce2e6ce6c5c1faa4cd;hp=896fed5f78ebeca9367a413da4503b05015988fd;hpb=475ba35502579302593f4735c853c49ef1845dcb;p=dotfiles.git diff --git a/stow/oh-my-zsh/.oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh b/stow/oh-my-zsh/.oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh deleted file mode 100644 index 896fed5..0000000 --- a/stow/oh-my-zsh/.oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh +++ /dev/null @@ -1,128 +0,0 @@ -########################### -# Settings - -# These can be overwritten any time. -# If they are not set yet, they will be -# overwritten with their default values - -default fastfile_dir "${HOME}/.fastfile" -default fastfile_var_prefix "§" - -########################### -# Impl - -# -# Generate a shortcut -# -# Arguments: -# 1. name - The name of the shortcut (default: name of the file) -# 2. file - The file or directory to make the shortcut for -# STDOUT: -# => fastfile_print -# -function fastfile() { - test "$2" || 2="." - file=$(readlink -f "$2") - - test "$1" || 1="$(basename "$file")" - name=$(echo "$1" | tr " " "_") - - - mkdir -p "${fastfile_dir}" - echo "$file" > "$(fastfile_resolv "$name")" - - fastfile_sync - fastfile_print "$name" -} - -# -# Resolve the location of a shortcut file (the database file, where the value is written!) -# -# Arguments: -# 1. name - The name of the shortcut -# STDOUT: -# The path to the shortcut file -# -function fastfile_resolv() { - echo "${fastfile_dir}/${1}" -} - -# -# Get the real path of a shortcut -# -# Arguments: -# 1. name - The name of the shortcut -# STDOUT: -# The path -# -function fastfile_get() { - cat "$(fastfile_resolv "$1")" -} - -# -# Print a shortcut -# -# Arguments: -# 1. name - The name of the shortcut -# STDOUT: -# Name and value of the shortcut -# -function fastfile_print() { - echo "${fastfile_var_prefix}${1} -> $(fastfile_get "$1")" -} - -# -# List all shortcuts -# -# STDOUT: -# (=> fastfile_print) for each shortcut -# -function fastfile_ls() { - 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")" - done | column -t -s "|" -} - -# -# Remove a shortcut -# -# Arguments: -# 1. name - The name of the shortcut (default: name of the file) -# STDOUT: -# => fastfile_print -# -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}"/*(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 -} - -################################## -# Shortcuts - -alias ff=fastfile -alias ffp=fastfile_print -alias ffrm=fastfile_rm -alias ffls=fastfile_ls -alias ffsync=fastfile_sync - -################################## -# Init - -fastfile_sync