Generate CLI options for the envbuilder command.
()
| 188 | |
| 189 | // Generate CLI options for the envbuilder command. |
| 190 | func (o *Options) CLI() serpent.OptionSet { |
| 191 | options := serpent.OptionSet{ |
| 192 | { |
| 193 | Flag: "setup-script", |
| 194 | Env: WithEnvPrefix("SETUP_SCRIPT"), |
| 195 | Value: serpent.StringOf(&o.SetupScript), |
| 196 | Description: "The script to run before the init script. It runs as " + |
| 197 | "the root user regardless of the user specified in the devcontainer.json " + |
| 198 | "file. SetupScript is ran as the root user prior to the init script. " + |
| 199 | "It is used to configure envbuilder dynamically during the runtime. e.g. " + |
| 200 | "specifying whether to start systemd or tiny init for PID 1.", |
| 201 | }, |
| 202 | { |
| 203 | Flag: "init-script", |
| 204 | Env: WithEnvPrefix("INIT_SCRIPT"), |
| 205 | // Default: "sleep infinity", // TODO: reinstate once legacy opts are removed. |
| 206 | Value: serpent.StringOf(&o.InitScript), |
| 207 | Description: "The script to run to initialize the workspace. Default: `sleep infinity`.", |
| 208 | }, |
| 209 | { |
| 210 | Flag: "init-command", |
| 211 | Env: WithEnvPrefix("INIT_COMMAND"), |
| 212 | // Default: "/bin/sh", // TODO: reinstate once legacy opts are removed. |
| 213 | Value: serpent.StringOf(&o.InitCommand), |
| 214 | Description: "The command to run to initialize the workspace. Default: `/bin/sh`.", |
| 215 | }, |
| 216 | { |
| 217 | Flag: "init-args", |
| 218 | Env: WithEnvPrefix("INIT_ARGS"), |
| 219 | Value: serpent.StringOf(&o.InitArgs), |
| 220 | Description: "The arguments to pass to the init command. They are " + |
| 221 | "split according to /bin/sh rules with " + |
| 222 | "https://github.com/kballard/go-shellquote.", |
| 223 | }, |
| 224 | { |
| 225 | Flag: "cache-repo", |
| 226 | Env: WithEnvPrefix("CACHE_REPO"), |
| 227 | Value: serpent.StringOf(&o.CacheRepo), |
| 228 | Description: "The name of the container registry to push the cache " + |
| 229 | "image to. If this is empty, the cache will not be pushed.", |
| 230 | }, |
| 231 | { |
| 232 | Flag: "base-image-cache-dir", |
| 233 | Env: WithEnvPrefix("BASE_IMAGE_CACHE_DIR"), |
| 234 | Value: serpent.StringOf(&o.BaseImageCacheDir), |
| 235 | Description: "The path to a directory where the base image " + |
| 236 | "can be found. This should be a read-only directory solely mounted " + |
| 237 | "for the purpose of caching the base image.", |
| 238 | }, |
| 239 | { |
| 240 | Flag: "layer-cache-dir", |
| 241 | Env: WithEnvPrefix("LAYER_CACHE_DIR"), |
| 242 | Value: serpent.StringOf(&o.LayerCacheDir), |
| 243 | Description: "The path to a directory where built layers will " + |
| 244 | "be stored. This spawns an in-memory registry to serve the layers " + |
| 245 | "from.", |
| 246 | }, |
| 247 | { |