pastebin/cmd/pb/main.go

37 lines
603 B
Go
Raw Normal View History

package main
import (
2019-07-11 12:59:40 +00:00
"log"
"os"
"github.com/prologic/pastebin/client"
"github.com/namsral/flag"
)
const (
defaultConfig = "pastebin.conf"
defaultUserConfig = "~/.pastebin.conf"
2019-07-11 12:59:40 +00:00
defaultURL = "http://localhost:8000"
)
func main() {
var (
url string
insecure bool
)
flag.StringVar(&url, "url", defaultURL, "pastebin service url")
flag.BoolVar(&insecure, "insecure", false, "insecure (skip ssl verify)")
flag.Parse()
2019-07-11 12:59:40 +00:00
cli := client.NewClient(url, insecure)
err := cli.Paste(os.Stdin)
if err != nil {
log.Printf("error posting paste: %s", err)
os.Exit(1)
}
}