haste-client-go

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

Hastebin Client (in Go)

Yet another CLI for hastebin, this one written in Go. It is intended to be used similarly to the original haste client, but also be able to get/read hastes.
As an added bonus, there's also cross-platform support without dependencies on other tools.

It also supports client certificates for mTLS for some reason.

Installation

Navigate to the latest release and download the client for your OS and architecture.

Usage

Creating a haste

Without any arguments, haste reads from the STDIN:

cat file | haste

Provided with a file argument, haste will create a haste from the contents of that file and return the URL pointing to it:

url=$(haste file) # equivalent to cat file | haste
echo $url         # e.g. https://hastebin.com/ogoquyocaq
Reading a haste

haste can read a haste using the get command:

haste get <key>           # prints the haste contents to STDOUT
haste get <key> -o ./file # prints the haste contents to ./file
Help

For more detailed information on how haste can be used, use haste --help or look here:

haste v1.0.0
A hastebin client that can create hastes from files and STDIN and read hastes from a haste-server instance.

Usage:
  haste [file] [flags]
  haste [command]

Examples:
echo Test | haste
cat ./file | haste
haste ./file

Available Commands:
  get         Get a haste from the server
  help        Help about any command

Flags:
      --client-cert string       Client certificate path
      --client-cert-key string   Client certificate key path
  -c, --config string            Config file [$HOME/.haste-client-go.yaml]
  -h, --help                     help for haste
  -s, --server string            Server URL (default "https://hastebin.com")
  -v, --version                  Print the version number

Use "haste [command] --help" for more information about a command.
Config

The global flags can also be configured by creating $HOME/.haste-client-go.yaml or referencing a configuration file using the -c/--config flag.

server: <url>
clientCert: <file location> # expects a certificate file in PEM format
clientCertKey: <file location> # expects a certificate key file in PEM format

Build

Requires golang 1.15+.

If there is no release for your OS and architecture or if you want to build the binary yourself for other reasons, you can follow these steps:

git clone git@github.com:jagoe/haste-client-go.git        # clone this repo
cd haste-client-go
[GOARCH=<your architecture>] [GOOS=<your OS>] make build  # build client
sudo mv ./bin/haste /usr/local/bin/haste                  # move to a bin directory in your PATH

Author

Jakob Göbel (goebel.jakob@gmail.com)

License

Apache License 2.0

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL