AutoYADM commit: 2025-07-14 22:25:21
This commit is contained in:
parent
23c5fc55bd
commit
7a0b858b3c
1 changed files with 18 additions and 0 deletions
18
.config/fish/functions/uri-path.fish
Normal file
18
.config/fish/functions/uri-path.fish
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue