forked from joewalnes/websocketd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
help.go
91 lines (66 loc) · 3.05 KB
/
help.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Copyright 2013 Joe Walnes and the websocketd team.
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"os"
"path/filepath"
"strings"
)
const (
help = `
{{binary}} ({{version}})
{{binary}} is a command line tool that will allow any executable program
that accepts input on stdin and produces output on stdout to be turned into
a WebSocket server.
Usage:
Export a single executable program a WebSocket server:
{{binary}} [options] program [program args]
Or, export an entire directory of executables as WebSocket endpoints:
{{binary}} [options] --dir=SOMEDIR
Options:
--port=PORT HTTP port to listen on.
--address=ADDRESS Addresseto bind to (multiple options allowed)
Use square brackets to specify IPv6 address.
Default: "" (all)
--basepath=PATH Base path in URLs to serve from.
Default: / (root of domain)
--reverselookup={true,false} Perform DNS reverse lookups on remote clients.
Default: true
--dir=DIR Allow all scripts in the local directory
to be accessed as WebSockets. If using this,
option, then the standard program and args
options should not be specified.
--staticdir=DIR Serve static files in this directory over HTTP.
--cgidir=DIR Serve CGI scripts in this directory over HTTP.
--help Print help and exit.
--version Print version and exit.
--license Print license and exit.
--devconsole Enable interactive development console.
This enables you to access the websocketd
server with a web-browser and use a
user interface to quickly test WebSocket
endpoints. For example, to test an
endpoint at ws://[host]/foo, you can
visit http://[host]/foo in your browser.
This flag cannot be used in conjunction
with --staticdir or --cgidir.
--loglevel={debug, Log level to use (from most to least
trace, verbose).
access, Default: access
info,
error,
fatal}
Full documentation at http://websocketd.com/
Copyright 2013 Joe Walnes and the websocketd team. All rights reserved.
BSD license: Run '{{binary}} --license' for details.
`
)
func PrintHelp() {
msg := strings.Trim(help, " \n")
msg = strings.Replace(msg, "{{binary}}", filepath.Base(os.Args[0]), -1)
msg = strings.Replace(msg, "{{version}}", Version(), -1)
fmt.Fprintf(os.Stderr, "%s\n", msg)
}