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 | /* |
6 | usage: shrt <command> [arguments] |
7 | |
8 | Shrt is a URL shortener and go-get redirector. |
9 | |
10 | Shrt is a URL shortener service (much like bit.ly without the |
11 | trackers) that also handles go-get requests. The latter are a |
12 | specific GET request query used by the Go programming language |
13 | toolchain to aid in the downloading of utilities and libraries |
14 | prior to build and installation. |
15 | |
16 | Upon invocation, shrt does one of two things depending |
17 | on the presence or absence of the init argument. If the init |
18 | argument is present, a series of questions is asked, the responses |
19 | are recorded in a configuration file, and the program exits. If |
20 | the init argument is absent, shrt reads the configuration and |
21 | database files into memory, binds to the port specified by the |
22 | -l flag, and begins serving requests. |
23 | |
24 | Shortlinks are recorded in the database, and any request path |
25 | not matching a shortlink is assumed to be a go-get request. This |
26 | is by design, but can result in specious redirects. Additionally, |
27 | subdirectory paths are not allowed. |
28 | |
29 | Shortlinks generate an HTTP 301 response. Go-get requests generate |
30 | an HTTP 200 response. If configured, requests to the base path |
31 | (i.e., "/") generate an HTTP 302 response. |
32 | |
33 | In order to add a new shortlink to the database, simply edit the |
34 | file. After saving, users on Unix systems may send SIGHUP to a |
35 | running server process to reload the file. Non-Unix users will need |
36 | to restart the server. |
37 | |
38 | The commands are: |
39 | |
40 | serve serve requests |
41 | env print Shrt environment information |
42 | version print version information |
43 | |
44 | Use "shrt help <command>" for more information about a command. |
45 | |
46 | Additional topics are: |
47 | |
48 | environment environment variables |
49 | |
50 | Use "shrt help <topic>" for more information about that topic. |
51 | |
52 | # Serve requests |
53 | |
54 | usage: shrt serve URL |
55 | |
56 | Serve serves HTTP requests. |
57 | |
58 | Shrt listens and serves shortlinks and go-get requests on the provided |
59 | URL. The only recognized scheme is http. |
60 | |
61 | # Print Shrt environment information |
62 | |
63 | usage: shrt env [-u] [-w] [var ...] |
64 | |
65 | Env prints Shrt environment information. |
66 | |
67 | By default env prints information as a shell script. If one or more |
68 | variable names is given as arguments, env prints the value of each |
69 | named variable on its own line. |
70 | |
71 | The -u flag requires one or more arguments and unsets |
72 | the default setting for the named environment variables, |
73 | if one has been set with 'shrt env -w'. |
74 | |
75 | The -w flag requires one or more arguments of the |
76 | form NAME=VALUE and changes the default settings |
77 | of the named environment variables to the given values. If the same |
78 | NAME is provided multiple times, the last one takes effect. |
79 | |
80 | For more about environment variables, see 'shrt help environment'. |
81 | |
82 | # Print version information |
83 | |
84 | usage: version |
85 | |
86 | Version prints program version information. |
87 | |
88 | Version information is compliant with version 2.0.0 of the semver |
89 | spec. If the version includes a pre-release identifier, build metadata |
90 | is also appended to the reported version. |
91 | |
92 | # Environment variables |
93 | |
94 | The shrt command consults environment variables for configuration. If |
95 | an environment variable is unset, the shrt command uses a sensible |
96 | default setting. To see the effective setting of the variable <NAME>, |
97 | run 'shrt env <NAME>'. To change the default setting, run 'shrt env -w |
98 | <NAME>=<VALUE>'. Defaults changed using 'shrt env -w' are recorded in |
99 | a Shrt environment configuration file stored in /etc/shrt/config on |
100 | Unix systems and C:\ProgramData\shrt\config on Windows. The location |
101 | of the configuration file can be changed by setting the environment |
102 | variable DGITENV, and 'shrt env DGITENV' prints the effective |
103 | location, but 'shrt env -w' cannot change the default location. See |
104 | 'shrt help env' for details. |
105 | |
106 | Environment 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 | */ |
135 | package main |