From 7a0b858b3cbe705de2aa2d8e4b15b0d3757c9449 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Mon, 14 Jul 2025 22:25:21 -0400 Subject: [PATCH] AutoYADM commit: 2025-07-14 22:25:21 --- .config/fish/functions/uri-path.fish | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .config/fish/functions/uri-path.fish diff --git a/.config/fish/functions/uri-path.fish b/.config/fish/functions/uri-path.fish new file mode 100644 index 00000000..ae0a5742 --- /dev/null +++ b/.config/fish/functions/uri-path.fish @@ -0,0 +1,18 @@ +function uri-path + argparse h/help r/reverse -- $argv + if set -q _flag_h + echo "Convert a file URI to a Path." + echo "-h/--help for help." + echo "-r/--reverse to convert a path to URI." + end + if test -z "$argv[1]" + read -f input + else + set input $argv[1] + end + if not set -q _flag_r + string unescape --style=url "$input" | string replace -a ' ' '\\ ' | string replace 'file://' '' + else + printf 'file://%s\n' (string replace '\\ ' ' ' "$input" | string escape --style=url) + end +end