[dpaste] Add dpaste plugin

pull/2/head
Roman Inflianskas 10 years ago committed by Bruno Pinto
parent 06b35235ff
commit a58c498362

@ -0,0 +1,23 @@
The MIT License (MIT)
Copyright (c) 2014 Roman Inflianskas
Copyright (c) 2014 Paul Joannon (sprunge.fish)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,37 @@
# Just a dpaste (https://github.com/bartTC/dpaste) wrapper for fish-shell
# Roman Inflianskas (rominf) <infroma@gmail.com>
# Based on fish-sprunge plugin:
# Paul Joannon (paulloz) <paul.joannon@gmail.com>
# https://github.com/Paulloz/fish-sprunge
# Based on oh-my-zsh's sprunge plugin
if test -z $dpaste_keyword
set dpaste_keyword content
end
if test -z $dpaste_url
set dpaste_url https://dpaste.de/api/
end
function dpaste_send
curl -F "$dpaste_keyword=<-" $dpaste_url 2> /dev/null | sed "s/.*\"\(.*\)\".*/\1\n/"
end
function dpaste
if isatty
if [ (count $argv) -gt 0 ]
if [ -f $argv ]
cat $argv
else
echo $argv
end | dpaste_send
else
echo -e "Usage:
* dpaste < README.md
* dpaste README.md
* cat README.md | dpaste
* dpaste "I \<3 to paste""
end
else
dpaste_send
end
end
Loading…
Cancel
Save