From 227c2738b8da4acab3119790faf875758a9206da Mon Sep 17 00:00:00 2001 From: Jorge Bucaran Date: Wed, 27 Apr 2016 02:05:04 +0900 Subject: [PATCH] Ditch -F option in ln and simplify code introduced in #231. ln -F is relevant only when the target is a directory, in which case `ln` will delete the directory so that the link can occur. In fisherman, we use links in only two places: 1. Linking files into .config/fish/{functions,completions}, and 2. Linking local plugins into the .config/fisherman If my calculations are correct, we don't need -F in either case. Both {functions/completions} never contain directories, so (1) is probably safe. The fisherman config only contains directories to installed plugins, so not using -F actually prevents the user from overwriting a plugin currently installed with a local plugin. --- fisher.fish | 23 +++++++++-------------- package.json | 2 +- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/fisher.fish b/fisher.fish index 8d57f18..c721508 100644 --- a/fisher.fish +++ b/fisher.fish @@ -1,5 +1,5 @@ function fisher - set -g fisher_version "2.1.11" + set -g fisher_version "2.1.12" set -g fisher_spinners ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏ function __fisher_show_spinner @@ -39,12 +39,6 @@ function fisher set -g fisher_bundle "$fish_config/fishfile" end - if test (uname -s) = "OpenBSD" - set ln_flags = "-sf" - else - set ln_flags = "-sfF" - end - if not command mkdir -p "$fish_config/"{conf.d,functions,completions} "$fisher_config" "$fisher_cache" __fisher_log error " I couldn't create the fisherman configuration. @@ -374,7 +368,7 @@ function __fisher_plugin_fetch_items end if test -d "$i" - command ln $ln_flags "$i" "$fisher_config/$names[1]" + command ln -sf "$i" "$fisher_config/$names[1]" set links $links "$names[1]" continue end @@ -384,7 +378,7 @@ function __fisher_plugin_fetch_items if test -z "$names[2]" if test -d "$source" if test -L "$source" - command ln $ln_flags "$source" "$fisher_config" + command ln -sf "$source" "$fisher_config" else command cp -rf "$source" "$fisher_config" end @@ -619,7 +613,8 @@ function __fisher_plugin_enable -a path set -l target "$fish_config/$dir/$base" - command ln $ln_flags "$file" "$target" + command ln -sf "$file" "$target" + builtin source "$target" if test "$base" = "set_color_custom.fish" @@ -630,19 +625,19 @@ function __fisher_plugin_enable -a path for file in $path/conf.d/*.{py,awk} set -l base (basename "$file") - command ln $ln_flags "$file" "$fish_config/conf.d/$base" + command ln -sf "$file" "$fish_config/conf.d/$base" end for file in $path/{functions/,}*.{py,awk} set -l base (basename "$file") - command ln $ln_flags "$file" "$fish_config/functions/$base" + command ln -sf "$file" "$fish_config/functions/$base" end for file in $path/conf.d/*.fish set -l base (basename "$file") set -l target "$fish_config/conf.d/$base" - command ln $ln_flags "$file" "$target" + command ln -sf "$file" "$target" builtin source "$target" end @@ -650,7 +645,7 @@ function __fisher_plugin_enable -a path set -l base (basename "$file") set -l target "$fish_config/completions/$base" - command ln $ln_flags "$file" "$target" + command ln -sf "$file" "$target" builtin source "$target" end diff --git a/package.json b/package.json index 0247148..1288790 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fisherman", "description": "fish plugin manager", - "version": "2.1.11", + "version": "2.1.12", "author": "Jorge Bucaran", "homepage": "https://github.com/fisherman/fisherman", "bugs": "https://github.com/fisherman/fisherman/issues",