diff --git a/.config/fish/functions/uri-path.fish b/.config/fish/functions/uri-path.fish index ae0a5742..dca5555b 100644 --- a/.config/fish/functions/uri-path.fish +++ b/.config/fish/functions/uri-path.fish @@ -4,15 +4,16 @@ function uri-path echo "Convert a file URI to a Path." echo "-h/--help for help." echo "-r/--reverse to convert a path to URI." + return 0 end - if test -z "$argv[1]" + if test -z "$argv" read -f input else - set input $argv[1] + set input $argv end if not set -q _flag_r - string unescape --style=url "$input" | string replace -a ' ' '\\ ' | string replace 'file://' '' + string unescape --style=url "$input" | string replace 'file://' '' else - printf 'file://%s\n' (string replace '\\ ' ' ' "$input" | string escape --style=url) + printf 'file://%s\n' (string escape --style=url "$input") end end