mirror of
https://github.com/eoli3n/dotfiles
synced 2024-11-22 23:12:32 +01:00
updated uptest.fish
This commit is contained in:
parent
46f8be776f
commit
c39e9afa5a
@ -1,17 +0,0 @@
|
||||
#!/usr/bin/fish
|
||||
|
||||
# base : https://github.com/fish-shell/fish-shell/issues/939#issuecomment-22058614
|
||||
|
||||
# upload image : up file.png
|
||||
# upload piped data : cat file.txt | up
|
||||
# upload clipboard : up
|
||||
# validation : if filetype is txt then open vim to valid or edit
|
||||
# catch url : middle clic to paste url
|
||||
|
||||
# If filename as argument
|
||||
if isatty stdin
|
||||
cat $argv
|
||||
# Else piping data
|
||||
else
|
||||
cat -
|
||||
end
|
36
roles/fish/files/fish/cli/functions/uptest.fish
Normal file
36
roles/fish/files/fish/cli/functions/uptest.fish
Normal file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/fish
|
||||
|
||||
# base : https://github.com/fish-shell/fish-shell/issues/939#issuecomment-22058614
|
||||
|
||||
# upload image : up file.png
|
||||
# upload piped data : cat file.txt | up
|
||||
# upload clipboard : up
|
||||
# validation : if clipboard then open vim to valid or edit
|
||||
# wq = ok, q = abort
|
||||
# catch url : middle clic to paste url
|
||||
|
||||
|
||||
function uptest --description 'Upload datas'
|
||||
|
||||
# Set commands
|
||||
set clipboard_copy wl-copy
|
||||
set clipboard_paste wl-paste
|
||||
|
||||
# If filename as argument
|
||||
if isatty stdin
|
||||
echo "Upload $argv"
|
||||
# Upload img to x0.at because ix.io fails to set filetype
|
||||
curl -F "file=@$argv" https://x0.at/ | read -l url
|
||||
# Else pipe data
|
||||
else
|
||||
echo "Upload pipe"
|
||||
# Upload text to ix
|
||||
cat - | curl -F 'f:1=<-' 'http://ix.io' | read -l url
|
||||
end
|
||||
|
||||
echo $url
|
||||
# Auto copy
|
||||
#if which $clipboard_copy &> /dev/null
|
||||
# echo $url | $clipboard_copy
|
||||
#end
|
||||
end
|
Loading…
Reference in New Issue
Block a user