cmd/shrt/doc.go in go-shrt

at v0.4.1

1// See LICENSE file for copyright and license details
2// Code generated by 'go test ./cmd/shrt -v -run=TestDocsUpToDate -fixdocs'; DO NOT EDIT
3// Edit the code in other files and then execute 'go generate ./cmd/shrt' to generate this one.
4
5/*
6usage: shrt <command> [arguments]
7
8Shrt is a URL shortener and go-get redirector.
9
10Shrt is a URL shortener service (much like bit.ly without the
11trackers) that also handles go-get requests. The latter are a
12specific GET request query used by the Go programming language
13toolchain to aid in the downloading of utilities and libraries
14prior to build and installation.
15
16Upon invocation, shrt does one of two things depending
17on the presence or absence of the init argument. If the init
18argument is present, a series of questions is asked, the responses
19are recorded in a configuration file, and the program exits. If
20the init argument is absent, shrt reads the configuration and
21database files into memory, binds to the port specified by the
22-l flag, and begins serving requests.
23
24Shortlinks are recorded in the database, and any request path
25not matching a shortlink is assumed to be a go-get request. This
26is by design, but can result in specious redirects. Additionally,
27subdirectory paths are not allowed.
28
29Shortlinks generate an HTTP 301 response. Go-get requests generate
30an HTTP 200 response. If configured, requests to the base path
31(i.e., "/") generate an HTTP 302 response.
32
33In order to add a new shortlink to the database, simply edit the
34file. After saving, users on Unix systems may send SIGHUP to a
35running server process to reload the file. Non-Unix users will need
36to restart the server.
37
38The commands are:
39
40 serve serve requests
41 env print Shrt environment information
42 version print version information
43
44Use "shrt help <command>" for more information about a command.
45
46Additional topics are:
47
48 environment environment variables
49
50Use "shrt help <topic>" for more information about that topic.
51
52# Serve requests
53
54usage: shrt serve URL
55
56Serve serves HTTP requests.
57
58Shrt listens and serves shortlinks and go-get requests on the provided
59URL. The only recognized scheme is http.
60
61# Print Shrt environment information
62
63usage: shrt env [-u] [-w] [var ...]
64
65Env prints Shrt environment information.
66
67By default env prints information as a shell script. If one or more
68variable names is given as arguments, env prints the value of each
69named variable on its own line.
70
71The -u flag requires one or more arguments and unsets
72the default setting for the named environment variables,
73if one has been set with 'shrt env -w'.
74
75The -w flag requires one or more arguments of the
76form NAME=VALUE and changes the default settings
77of the named environment variables to the given values. If the same
78NAME is provided multiple times, the last one takes effect.
79
80For more about environment variables, see 'shrt help environment'.
81
82# Print version information
83
84usage: version
85
86Version prints program version information.
87
88Version information is compliant with version 2.0.0 of the semver
89spec. If the version includes a pre-release identifier, build metadata
90is also appended to the reported version.
91
92# Environment variables
93
94The shrt command consults environment variables for configuration. If
95an environment variable is unset, the shrt command uses a sensible
96default setting. To see the effective setting of the variable <NAME>,
97run 'shrt env <NAME>'. To change the default setting, run 'shrt env -w
98<NAME>=<VALUE>'. Defaults changed using 'shrt env -w' are recorded in
99a Shrt environment configuration file stored in /etc/shrt/config on
100Unix systems and C:\ProgramData\shrt\config on Windows. The location
101of the configuration file can be changed by setting the environment
102variable DGITENV, and 'shrt env DGITENV' prints the effective
103location, but 'shrt env -w' cannot change the default location. See
104'shrt help env' for details.
105
106Environment variables:
107
108 SHRTENV
109 The location of the Shrt environment configuration
110 file. Cannot be set using 'shrt env -w'.
111 SHRT_SRVNAME
112 The server name of the Shrt host.
113 SHRT_SCMTYPE
114 The SCM (or VCS) type.
115 SHRT_SUFFIX
116 The SCM repository suffix, if required by repository
117 host.
118 SHRT_RDRNAME
119 The server name of the repository host.
120 SHRT_BARERDR
121 Where requests with an empty path should redirect.
122 SHRT_DBPATH
123 The absolute path to the database file.
124 SHRT_GOSOURCEDIR
125 The string to append to the URL for go-get redirects
126 to form the directory entry in the go-source meta tag.
127 This key is experimental and may be removed in a
128 future release.
129 SHRT_GOSOURCEFILE
130 The string to append to the URL for go-get redirects
131 to form the file entry in the go-source meta tag. This
132 key is experimental and may be removed in a future
133 release.
134*/
135package main