Skip to content

Commit f03fa6e

Browse files
committed
Adjust description and flags
1 parent e94b8c3 commit f03fa6e

File tree

1 file changed

+117
-132
lines changed

1 file changed

+117
-132
lines changed

config.go

Lines changed: 117 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -39,242 +39,227 @@ type Config struct {
3939
func (c *Config) Options() serpent.OptionSet {
4040
return serpent.OptionSet{
4141
{
42-
Name: "Setup Script",
43-
Env: "SETUP_SCRIPT",
4442
Flag: "setup-script",
43+
Env: "SETUP_SCRIPT",
4544
Value: serpent.StringOf(&c.SetupScript),
46-
Description: `SetupScript is the script to run before the init script.
47-
It runs as the root user regardless of the user specified
48-
in the devcontainer.json file.
49-
50-
SetupScript is ran as the root user prior to the init script.
51-
It is used to configure envbuilder dynamically during the runtime.
52-
e.g. specifying whether to start ` + "`systemd`" + ` or ` + "`tiny init`" + ` for PID 1.`,
45+
Description: "SetupScript is the script to run before the init script. It runs as " +
46+
"the root user regardless of the user specified in the devcontainer.json " +
47+
"file.\n\nSetupScript is ran as the root user prior to the init script. " +
48+
"It is used to configure envbuilder dynamically during the runtime. e.g. " +
49+
"specifying whether to start systemd or tiny init for PID 1.",
5350
},
5451
{
55-
Name: "Init Script",
52+
Flag: "init-script",
5653
Env: "INIT_SCRIPT",
5754
Default: "sleep infinity",
5855
Value: serpent.StringOf(&c.InitScript),
5956
Description: "InitScript is the script to run to initialize the workspace.",
6057
},
6158
{
62-
Name: "Init Command",
59+
Flag: "init-command",
6360
Env: "INIT_COMMAND",
6461
Default: "/bin/sh",
6562
Value: serpent.StringOf(&c.InitCommand),
6663
Description: "InitCommand is the command to run to initialize the workspace.",
6764
},
6865
{
69-
Name: "Init Args",
66+
Flag: "init-args",
7067
Env: "INIT_ARGS",
7168
Value: serpent.StringOf(&c.InitArgs),
72-
Description: `InitArgs are the arguments to pass to the init command.
73-
They are split according to ` + "`/bin/sh`" + ` rules with
74-
https://github.com/kballard/go-shellquote.`,
69+
Description: "InitArgs are the arguments to pass to the init command. They are " +
70+
"split according to /bin/sh rules with " +
71+
"https://github.com/kballard/go-shellquote.",
7572
},
7673
{
77-
Name: "Cache Repo",
74+
Flag: "cache-repo",
7875
Env: "CACHE_REPO",
7976
Value: serpent.StringOf(&c.CacheRepo),
80-
Description: `CacheRepo is the name of the container registry
81-
to push the cache image to. If this is empty, the cache
82-
will not be pushed.`,
77+
Description: "CacheRepo is the name of the container registry to push the cache " +
78+
"image to. If this is empty, the cache will not be pushed.",
8379
},
8480
{
85-
Name: "Base Image Cache Dir",
81+
Flag: "base-image-cache-dir",
8682
Env: "BASE_IMAGE_CACHE_DIR",
8783
Value: serpent.StringOf(&c.BaseImageCacheDir),
88-
Description: `BaseImageCacheDir is the path to a directory where the base
89-
image can be found. This should be a read-only directory
90-
solely mounted for the purpose of caching the base image.`,
84+
Description: "BaseImageCacheDir is the path to a directory where the base image " +
85+
"can be found. This should be a read-only directory solely mounted " +
86+
"for the purpose of caching the base image.",
9187
},
9288
{
93-
Name: "Layer Cache Dir",
89+
Flag: "layer-cache-dir",
9490
Env: "LAYER_CACHE_DIR",
9591
Value: serpent.StringOf(&c.LayerCacheDir),
96-
Description: `LayerCacheDir is the path to a directory where built layers
97-
will be stored. This spawns an in-memory registry to serve
98-
the layers from.`,
92+
Description: "LayerCacheDir is the path to a directory where built layers will " +
93+
"be stored. This spawns an in-memory registry to serve the layers " +
94+
"from.",
9995
},
10096
{
101-
Name: "Devcontainer Dir",
97+
Flag: "devcontainer-dir",
10298
Env: "DEVCONTAINER_DIR",
10399
Value: serpent.StringOf(&c.DevcontainerDir),
104-
Description: `DevcontainerDir is a path to the folder containing
105-
the devcontainer.json file that will be used to build the
106-
workspace and can either be an absolute path or a path
107-
relative to the workspace folder. If not provided, defaults to
108-
` + "`.devcontainer`" + `.`,
100+
Description: "DevcontainerDir is a path to the folder containing the " +
101+
"devcontainer.json file that will be used to build the workspace " +
102+
"and can either be an absolute path or a path relative to the " +
103+
"workspace folder. If not provided, defaults to `.devcontainer`.",
109104
},
110105
{
111-
Name: "Devcontainer JSON Path",
106+
Flag: "devcontainer-json-path",
112107
Env: "DEVCONTAINER_JSON_PATH",
113108
Value: serpent.StringOf(&c.DevcontainerJSONPath),
114-
Description: `DevcontainerJSONPath is a path to a devcontainer.json file
115-
that is either an absolute path or a path relative to
116-
DevcontainerDir. This can be used in cases where one wants
117-
to substitute an edited devcontainer.json file for the one
118-
that exists in the repo.`,
109+
Description: "DevcontainerJSONPath is a path to a devcontainer.json file that " +
110+
"is either an absolute path or a path relative to DevcontainerDir. " +
111+
"This can be used in cases where one wants to substitute an edited " +
112+
"devcontainer.json file for the one that exists in the repo.",
119113
},
120114
{
121-
Name: "Dockerfile Path",
115+
Flag: "dockerfile-path",
122116
Env: "DOCKERFILE_PATH",
123117
Value: serpent.StringOf(&c.DockerfilePath),
124-
Description: `DockerfilePath is a relative path to the Dockerfile that
125-
will be used to build the workspace. This is an alternative
126-
to using a devcontainer that some might find simpler.`,
118+
Description: "DockerfilePath is a relative path to the Dockerfile that will " +
119+
"be used to build the workspace. This is an alternative to using " +
120+
"a devcontainer that some might find simpler.",
127121
},
128122
{
129-
Name: "Build Context Path",
130-
Env: `BUILD_CONTEXT_PATH`,
123+
Flag: "build-context-path",
124+
Env: "BUILD_CONTEXT_PATH",
131125
Value: serpent.StringOf(&c.BuildContextPath),
132-
Description: `BuildContextPath can be specified when a DockerfilePath is specified outside the base WorkspaceFolder.
133-
This path MUST be relative to the WorkspaceFolder path into which the repo is cloned.`,
126+
Description: "BuildContextPath can be specified when a DockerfilePath is " +
127+
"specified outside the base WorkspaceFolder. This path MUST be " +
128+
"relative to the WorkspaceFolder path into which the repo is cloned.",
134129
},
135130
{
136-
Name: "Cache TTL Days",
131+
Flag: "cache-ttl-days",
137132
Env: "CACHE_TTL_DAYS",
138133
Value: serpent.Int64Of(&c.CacheTTLDays),
139-
Description: `CacheTTLDays is the number of days to use cached layers before
140-
expiring them. Defaults to 7 days.`,
134+
Description: "CacheTTLDays is the number of days to use cached layers before " +
135+
"expiring them. Defaults to 7 days.",
141136
},
142137
{
143-
Name: "Docker Config Base64",
138+
Flag: "docker-config-base64",
144139
Env: "DOCKER_CONFIG_BASE64",
145140
Value: serpent.StringOf(&c.DockerConfigBase64),
146-
Description: `DockerConfigBase64 is a base64 encoded Docker config
147-
file that will be used to pull images from private
148-
container registries.`,
141+
Description: "DockerConfigBase64 is a base64 encoded Docker config file that " +
142+
"will be used to pull images from private container registries.",
149143
},
150144
{
151-
Name: "Fallback Image",
145+
Flag: "fallback-image",
152146
Env: "FALLBACK_IMAGE",
153147
Value: serpent.StringOf(&c.FallbackImage),
154-
Description: `FallbackImage specifies an alternative image to use when neither
155-
an image is declared in the devcontainer.json file nor a Dockerfile is present.
156-
If there's a build failure (from a faulty Dockerfile) or a misconfiguration,
157-
this image will be the substitute.
158-
Set ` + "`ExitOnBuildFailure`" + ` to true to halt the container if the build faces an issue.`,
148+
Description: "FallbackImage specifies an alternative image to use when neither " +
149+
"an image is declared in the devcontainer.json file nor a Dockerfile " +
150+
"is present. If there's a build failure (from a faulty Dockerfile) " +
151+
"or a misconfiguration, this image will be the substitute. Set " +
152+
"ExitOnBuildFailure to true to halt the container if the build " +
153+
"faces an issue.",
159154
},
160155
{
156+
Flag: "exit-on-build-failure",
161157
Env: "EXIT_ON_BUILD_FAILURE",
162158
Value: serpent.BoolOf(&c.ExitOnBuildFailure),
163-
Description: `ExitOnBuildFailure terminates the container upon a build failure.
164-
This is handy when preferring the ` + "`FALLBACK_IMAGE`" + ` in cases where
165-
no devcontainer.json or image is provided. However, it ensures
166-
that the container stops if the build process encounters an error.`,
159+
Description: "ExitOnBuildFailure terminates the container upon a build failure. " +
160+
"This is handy when preferring the FALLBACK_IMAGE in cases where " +
161+
"no devcontainer.json or image is provided. However, it ensures " +
162+
"that the container stops if the build process encounters an error.",
167163
},
168164
{
169-
Name: "Force Safe",
165+
Flag: "force-safe",
170166
Env: "FORCE_SAFE",
171167
Value: serpent.BoolOf(&c.ForceSafe),
172-
Description: `ForceSafe ignores any filesystem safety checks.
173-
This could cause serious harm to your system!
174-
This is used in cases where bypass is needed
175-
to unblock customers.`,
168+
Description: "ForceSafe ignores any filesystem safety checks. This could cause " +
169+
"serious harm to your system! This is used in cases where bypass " +
170+
"is needed to unblock customers.",
176171
},
177172
{
178-
Name: "Insecure",
173+
Flag: "insecure",
179174
Env: "INSECURE",
180175
Value: serpent.BoolOf(&c.Insecure),
181-
Description: `Insecure bypasses TLS verification when cloning
182-
and pulling from container registries.`,
176+
Description: "Insecure bypasses TLS verification when cloning and pulling from " +
177+
"container registries.",
183178
},
184179
{
185-
Name: "Ignore Paths",
186-
Env: "IGNORE_PATHS",
187-
Value: serpent.StringArrayOf(&c.IgnorePaths),
188-
// Kubernetes frequently stores secrets in /var/run/secrets, and
189-
// other applications might as well. This seems to be a sensible
190-
// default, but if that changes, it's simple to adjust.
180+
Flag: "ignore-paths",
181+
Env: "IGNORE_PATHS",
182+
Value: serpent.StringArrayOf(&c.IgnorePaths),
191183
Default: "/var/run",
192-
Description: `IgnorePaths is a comma separated list of paths
193-
to ignore when building the workspace.`,
184+
Description: "IgnorePaths is a comma separated list of paths to ignore when " +
185+
"building the workspace.",
194186
},
195187
{
196-
Name: "Skip Rebuild",
188+
Flag: "skip-rebuild",
197189
Env: "SKIP_REBUILD",
198190
Value: serpent.BoolOf(&c.SkipRebuild),
199-
Description: `SkipRebuild skips building if the MagicFile exists.
200-
This is used to skip building when a container is
201-
restarting. e.g. docker stop -> docker start
202-
This value can always be set to true - even if the
203-
container is being started for the first time.`,
191+
Description: "SkipRebuild skips building if the MagicFile exists. This is used " +
192+
"to skip building when a container is restarting. e.g. docker stop -> " +
193+
"docker start This value can always be set to true - even if the " +
194+
"container is being started for the first time.",
204195
},
205196
{
206-
Name: "Git URL",
207-
Env: "GIT_URL",
208-
Value: serpent.StringOf(&c.GitURL),
209-
Description: `GitURL is the URL of the Git repository to clone.
210-
This is optional.`,
197+
Flag: "git-url",
198+
Env: "GIT_URL",
199+
Value: serpent.StringOf(&c.GitURL),
200+
Description: "GitURL is the URL of the Git repository to clone. This is optional.",
211201
},
212202
{
213-
Name: "Git Clone Depth",
214-
Env: "GIT_CLONE_DEPTH",
215-
Value: serpent.Int64Of(&c.GitCloneDepth),
216-
Description: `GitCloneDepth is the depth to use when cloning
217-
the Git repository.`,
203+
Flag: "git-clone-depth",
204+
Env: "GIT_CLONE_DEPTH",
205+
Value: serpent.Int64Of(&c.GitCloneDepth),
206+
Description: "GitCloneDepth is the depth to use when cloning the Git repository.",
218207
},
219208
{
220-
Name: "Git Clone Single Branch",
221-
Env: "GIT_CLONE_SINGLE_BRANCH",
222-
Value: serpent.BoolOf(&c.GitCloneSingleBranch),
223-
Description: `GitCloneSingleBranch clones only a single branch
224-
of the Git repository.`,
209+
Flag: "git-clone-single-branch",
210+
Env: "GIT_CLONE_SINGLE_BRANCH",
211+
Value: serpent.BoolOf(&c.GitCloneSingleBranch),
212+
Description: "GitCloneSingleBranch clones only a single branch of the Git repository.",
225213
},
226214
{
227-
Name: "Git Username",
228-
Env: "GIT_USERNAME",
229-
Value: serpent.StringOf(&c.GitUsername),
230-
Description: `GitUsername is the username to use for Git authentication.
231-
This is optional.`,
215+
Flag: "git-username",
216+
Env: "GIT_USERNAME",
217+
Value: serpent.StringOf(&c.GitUsername),
218+
Description: "GitUsername is the username to use for Git authentication. This is optional.",
232219
},
233220
{
234-
Name: "Git Password",
235-
Env: "GIT_PASSWORD",
236-
Value: serpent.StringOf(&c.GitPassword),
237-
Description: `GitPassword is the password to use for Git authentication.
238-
This is optional.`,
221+
Flag: "git-password",
222+
Env: "GIT_PASSWORD",
223+
Value: serpent.StringOf(&c.GitPassword),
224+
Description: "GitPassword is the password to use for Git authentication. This is optional.",
239225
},
240226
{
241-
Name: "Git HTTP Proxy URL",
242-
Env: "GIT_HTTP_PROXY_URL",
243-
Value: serpent.StringOf(&c.GitHTTPProxyURL),
244-
Description: `GitHTTPProxyURL is the url for the http proxy.
245-
This is optional.`,
227+
Flag: "git-http-proxy-url",
228+
Env: "GIT_HTTP_PROXY_URL",
229+
Value: serpent.StringOf(&c.GitHTTPProxyURL),
230+
Description: "GitHTTPProxyURL is the url for the http proxy. This is optional.",
246231
},
247232
{
248-
Name: "Workspace Folder",
233+
Flag: "workspace-folder",
249234
Env: "WORKSPACE_FOLDER",
250235
Value: serpent.StringOf(&c.WorkspaceFolder),
251-
Description: `WorkspaceFolder is the path to the workspace folder
252-
that will be built. This is optional.`,
236+
Description: "WorkspaceFolder is the path to the workspace folder that will " +
237+
"be built. This is optional.",
253238
},
254239
{
255-
Name: "SSL Cert Base64",
240+
Flag: "ssl-cert-base64",
256241
Env: "SSL_CERT_BASE64",
257242
Value: serpent.StringOf(&c.SSLCertBase64),
258-
Description: `SSLCertBase64 is the content of an SSL cert file.
259-
This is useful for self-signed certificates.`,
243+
Description: "SSLCertBase64 is the content of an SSL cert file. This is useful " +
244+
"for self-signed certificates.",
260245
},
261246
{
262-
Name: "Export Env File",
247+
Flag: "export-env-file",
263248
Env: "EXPORT_ENV_FILE",
264249
Value: serpent.StringOf(&c.ExportEnvFile),
265-
Description: `ExportEnvFile is an optional file path to a .env file where
266-
envbuilder will dump environment variables from devcontainer.json and
267-
the built container image.`,
250+
Description: "ExportEnvFile is an optional file path to a .env file where " +
251+
"envbuilder will dump environment variables from devcontainer.json " +
252+
"and the built container image.",
268253
},
269254
{
270-
Name: "Post Start Script Path",
255+
Flag: "post-start-script-path",
271256
Env: "POST_START_SCRIPT_PATH",
272257
Value: serpent.StringOf(&c.PostStartScriptPath),
273-
Description: `PostStartScriptPath is the path to a script that will be created by
274-
envbuilder based on the ` + "`postStartCommand`" + ` in devcontainer.json, if any
275-
is specified (otherwise the script is not created). If this is set, the
276-
specified InitCommand should check for the presence of this script and
277-
execute it after successful startup.`,
258+
Description: "PostStartScriptPath is the path to a script that will be created " +
259+
"by envbuilder based on the postStartCommand in devcontainer.json, " +
260+
"if any is specified (otherwise the script is not created). If this " +
261+
"is set, the specified InitCommand should check for the presence of " +
262+
"this script and execute it after successful startup.",
278263
},
279264
}
280265
}

0 commit comments

Comments
 (0)