2017-07-04 08:37:59 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2019-07-11 12:59:40 +00:00
|
|
|
"log"
|
2017-07-04 08:37:59 +00:00
|
|
|
"os"
|
|
|
|
|
2021-07-12 22:31:38 +00:00
|
|
|
"git.mills.io/prologic/pastebin/client"
|
2017-07-04 08:37:59 +00:00
|
|
|
|
|
|
|
"github.com/namsral/flag"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
defaultConfig = "pastebin.conf"
|
|
|
|
defaultUserConfig = "~/.pastebin.conf"
|
2019-07-11 12:59:40 +00:00
|
|
|
defaultURL = "http://localhost:8000"
|
2017-07-04 08:37:59 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
2017-07-04 08:37:59 +00:00
|
|
|
}
|