func SharedMain(usage func(io.Writer, ...interface{})) {
	flag.Var(&headersFlags, "H", "Additional `header`(s)")
	flag.IntVar(&fhttp.BufferSizeKb, "httpbufferkb", fhttp.BufferSizeKb,
		"Size of the buffer (max data size) for the optimized http client in `kbytes`")
	flag.BoolVar(&fhttp.CheckConnectionClosedHeader, "httpccch", fhttp.CheckConnectionClosedHeader,
		"Check for Connection: Close Header")
	if len(os.Args) < 2 {
		return
	}
	if strings.Contains(os.Args[1], "version") {
		if len(os.Args) >= 3 && strings.Contains(os.Args[2], "s") {
			fmt.Println(version.Short())
		} else {
			fmt.Println(version.Long())
		}
		os.Exit(0)
	}
	if strings.Contains(os.Args[1], "help") {
		usage(os.Stdout)
		os.Exit(0)
	}
}
SharedMain is the common part of main from fortio_main and fcurl.
package bincommon
import (
	"flag"
	"fmt"
	"io"
	"net/http"
	"os"
	"reflect"
	"strings"
	"fortio.org/fortio/fhttp"
	"fortio.org/fortio/fnet"
	"fortio.org/fortio/log"
	"fortio.org/fortio/version"
)
type headersFlagList struct{}
func (f *headersFlagList) String() string {
	return ""
}
func (f *headersFlagList) Set(value string) error {
	return httpOpts.AddAndValidateExtraHeader(value)
}
func FlagsUsage(w io.Writer, msgs ...interface{}) {
	_, _ = fmt.Fprintf(w, "flags are:\n")
	flag.CommandLine.SetOutput(w)
	flag.PrintDefaults()
	if len(msgs) > 0 {
		_, _ = fmt.Fprintln(w, msgs...)
	}
}
var (
	compressionFlag = flag.Bool("compression", false, "Enable http compression")
	keepAliveFlag   = flag.Bool("keepalive", true, "Keep connection alive (only for fast http 1.1)")
	halfCloseFlag   = flag.Bool("halfclose", false,
		"When not keepalive, whether to half close the connection (only for fast http)")
	httpReqTimeoutFlag  = flag.Duration("timeout", fhttp.HTTPReqTimeOutDefaultValue, "Connection and read timeout value (for http)")
	stdClientFlag       = flag.Bool("stdclient", false, "Use the slower net/http standard client (works for TLS)")
	http10Flag          = flag.Bool("http1.0", false, "Use http1.0 (instead of http 1.1)")
	httpsInsecureFlag   = flag.Bool("k", false, "Do not verify certs in https connections")
	httpsInsecureFlagL  = flag.Bool("https-insecure", false, "Long form of the -k flag")
	resolve             = flag.String("resolve", "", "Resolve CN of cert to this IP, so that we can call https://cn directly")
	headersFlags        headersFlagList
	httpOpts            fhttp.HTTPOptions
	followRedirectsFlag = flag.Bool("L", false, "Follow redirects (implies -std-client) - do not use for load test")
	userCredentialsFlag = flag.String("user", "", "User credentials for basic authentication (for http). Input data format"+
		" should be `user:password`")
	QuietFlag       = flag.Bool("quiet", false, "Quiet mode: sets the loglevel to Error and reduces the output.")
	contentTypeFlag = flag.String("content-type", "",
		"Sets http content type. Setting this value switches the request method from GET to POST.")
	PayloadSizeFlag = flag.Int("payload-size", 0, "Additional random payload size, replaces -payload when set > 0,"+
		" must be smaller than -maxpayloadsizekb. Setting this switches http to POST.")
	PayloadFlag = flag.String("payload", "", "Payload string to send along")
	PayloadFileFlag = flag.String("payload-file", "", "File `path` to be use as payload (POST for http), replaces -payload when set.")
	unixDomainSocketFlag = flag.String("unix-socket", "", "Unix domain socket `path` to use for physical connection")
	ConfigDirectoryFlag = flag.String("config", "",
		"Config directory `path` to watch for changes of dynamic flags (empty for no watch)")
	CertFlag = flag.String("cert", "", "`Path` to the certificate file to be used for client or server TLS")
	KeyFlag = flag.String("key", "", "`Path` to the key file matching the -cert")
	CACertFlag = flag.String("cacert", "",
		"`Path` to a custom CA certificate file to be used for the TLS client connections, "+
			"if empty, use https:// prefix for standard internet/system CAs")
	LogErrorsFlag = flag.Bool("log-errors", true, "Log http non 2xx/418 error codes as they occur")
	RunIDFlag = flag.Int64("runid", 0, "Optional RunID to add to json result and auto save filename, to match server mode")
)