1
0
mirror of https://github.com/seejohnrun/haste-client.git synced 2025-12-12 14:55:56 +00:00

Merge pull request #38 from xenithorb/patch-1

Haste lite-client improvement
This commit is contained in:
Konstantin Rybakov
2022-01-12 16:36:36 +03:00
committed by GitHub

View File

@@ -70,13 +70,22 @@ If you'd like an alternative on Windows that supports functionality similar to `
Han Boetes and @nickthename have contributed a simple shell-script alternative for those not interested in installing a RubyGem:
``` bash
haste() { a=$(cat); curl -X POST -s -d "$a" https://hastebin.com/documents | awk -F '"' '{print "https://hastebin.com/"$4}'; }
haste() {
local S="https" H="hastebin.com" P="" L="$1"
local SHP="${S}://${H}${P}/"
curl -X POST -s --data-binary @- "${SHP}documents" \
| awk -F '"' 'b{ b="."b }; {print a$4b}' a="${SHP}" b="${L}"
}
```
Where `S` is the scheme, `H` is the host, `P` is the port, and `L` is the language. Requires `curl`
Usage:
``` bash
cat file.txt | haste
cat file.txt | haste # cat file into hate, output url
haste sh < script.sh # Same as above, but ensure shell syntax highlighting
xsel -b | haste txt # Output clipboard buffer into haste, ensure no highlighting
```
And a more expansive BASH option by @diethnis can be found at: