"github.com/alecthomas/tuplespace" "github.com/alecthomas/tuplespace/server" "github.com/alecthomas/tuplespace/store" "github.com/codegangsta/martini" "github.com/ogier/pflag" "net/http" "os" "runtime" "time" ) var ( bindFlag = pflag.String("bind", "127.0.0.1:2619", "bind address") readTimeoutFlag = pflag.Duration("read-timeout", 30*time.Second, "HTTP server read timeout") writeTimeoutFlag = pflag.Duration("write-timeout", 30*time.Second, "HTTP server write timeout") ncpuFlag = pflag.Int("ncpu", runtime.NumCPU(), "number of cpus to use") logLevelFlag = pflag.String("log-level", "info", "log level (finest, fine, debug, info, warning, error, critical)") logLevels = map[string]log.Level{ "finest": log.FINEST, "fine": log.FINE, "debug": log.DEBUG, "info": log.INFO, "warning": log.WARNING, "error": log.ERROR, "critical": log.CRITICAL, } ) func fatalf(f string, args ...interface{}) { fmt.Fprintf(os.Stderr, "error: "+f, args...)
"runtime/pprof" "sync" "time" ) var ( baseUrl = flag.StringP("base-url", "b", "", "hostname (and path) to the root eg. http://spf13.com/") cfgfile = flag.String("config", "", "config file (default is path/config.yaml|json|toml)") checkMode = flag.Bool("check", false, "analyze content and provide feedback") draft = flag.BoolP("build-drafts", "D", false, "include content marked as draft") help = flag.BoolP("help", "h", false, "show this help") source = flag.StringP("source", "s", "", "filesystem path to read files relative from") destination = flag.StringP("destination", "d", "", "filesystem path to write files to") verbose = flag.BoolP("verbose", "v", false, "verbose output") version = flag.Bool("version", false, "which version of hugo") cpuprofile = flag.Int("profile", 0, "Number of times to create the site and profile it") watchMode = flag.BoolP("watch", "w", false, "watch filesystem for changes and recreate as needed") server = flag.BoolP("server", "S", false, "run a (very) simple web server") port = flag.String("port", "1313", "port to run web server on, default :1313") uglyUrls = flag.Bool("uglyurls", false, "use /filename.html instead of /filename/ ") ) func usage() { PrintErr("usage: hugo [flags]", "") flag.PrintDefaults() os.Exit(0) } func main() { flag.Usage = usage
Version = `xxd v2.0 2014-17-01 by Felix Geisendörfer and Eric Lagergren` ) // cli flags var ( autoskip = flag.BoolP("autoskip", "a", false, "toggle autoskip (* replaces nul lines") bars = flag.BoolP("bars", "B", false, "print |ascii| instead of ascii") binary = flag.BoolP("binary", "b", false, "binary dump, incompatible with -ps, -i, -r") columns = flag.IntP("cols", "c", -1, "format <cols> octets per line") ebcdic = flag.BoolP("ebcdic", "E", false, "use EBCDIC instead of ASCII") group = flag.IntP("group", "g", -1, "num of octets per group") cfmt = flag.BoolP("include", "i", false, "output in C include format") length = flag.Int64P("len", "l", -1, "stop after len octets") postscript = flag.BoolP("ps", "p", false, "output in postscript plain hd style") reverse = flag.BoolP("reverse", "r", false, "convert hex to binary") offset = flag.Int("off", 0, "revert with offset") seek = flag.StringP("seek", "s", "", "start at seek bytes abs") upper = flag.BoolP("uppercase", "u", false, "use uppercase hex letters") version = flag.BoolP("version", "v", false, "print version") ) // constants used in xxd() const ( ebcdicOffset = 0x40 ) // dumpType enum const ( dumpHex = iota dumpBinary dumpCformat
import ( "encoding/json" "fmt" log "github.com/alecthomas/log4go" "github.com/alecthomas/tuplespace" "github.com/alecthomas/tuplespace/client" "github.com/ogier/pflag" "os" "runtime" "time" ) var ( serverFlag = pflag.String("server", "http://127.0.0.1:2619/tuplespace/", "tuplespace server address") timeoutFlag = pflag.Duration("timeout", time.Second*60, "tuplespace operation timeout") copiesFlag = pflag.Int("copies", 1, "number of copies of the tuple to send") silentFlag = pflag.Bool("silent", false, "don't display received tuples") ) func fatalf(f string, args ...interface{}) { fmt.Fprintf(os.Stderr, "error: "+f+"\n", args...) os.Exit(1) } func parseTuple(arg string) (tuple tuplespace.Tuple) { err := json.Unmarshal([]byte(arg), &tuple) if err != nil { fatalf("invalid tuple (%s)", err.Error()) } return }