21 lines
408 B
Fish
21 lines
408 B
Fish
function copy
|
|
if test (count $argv) -eq 0
|
|
echo "Usage: copy <file>"
|
|
return 1
|
|
end
|
|
|
|
if not test -f $argv[1]
|
|
echo "Error: File '$argv[1]' not found"
|
|
return 1
|
|
end
|
|
|
|
cat $argv[1] | wl-copy
|
|
|
|
if test $status -eq 0
|
|
echo "Copied contents of '$argv[1]' to clipboard"
|
|
else
|
|
echo "Error: Failed to copy to clipboard"
|
|
return 1
|
|
end
|
|
end
|