Skip to content

Commit 568b273

Browse files
author
Ma Shimiao
committed
add label manpage and fix help
Signed-off-by: Ma Shimiao <[email protected]>
1 parent 03e8b89 commit 568b273

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

cmd/ocitools/generate.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var generateFlags = []cli.Flag{
3636
cli.StringFlag{Name: "mount-label", Usage: "selinux mount context label"},
3737
cli.StringSliceFlag{Name: "tmpfs", Usage: "mount tmpfs"},
3838
cli.StringSliceFlag{Name: "args", Usage: "command to run in the container"},
39-
cli.StringSliceFlag{Name: "env", Usage: "add environment variable"},
39+
cli.StringSliceFlag{Name: "env", Usage: "add environment variable e.g. key=value"},
4040
cli.StringFlag{Name: "cgroups-path", Usage: "specify the path to the cgroups"},
4141
cli.StringFlag{Name: "mount-cgroups", Value: "no", Usage: "mount cgroups (rw,ro,no)"},
4242
cli.StringSliceFlag{Name: "bind", Usage: "bind mount directories src:dest:(rw,ro)"},
@@ -168,6 +168,10 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
168168
if context.IsSet("env") {
169169
envs := context.StringSlice("env")
170170
for _, env := range envs {
171+
pair := strings.Split(env, "=")
172+
if len(pair) != 2 {
173+
return fmt.Errorf("incorrectly specified environment variable: %s", env)
174+
}
171175
g.AddProcessEnv(env)
172176
}
173177
}

man/ocitools-generate.1.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ read the configuration from `config.json`.
5858
Current working directory for the process
5959

6060
**--env**=[]
61-
Set environment variables
62-
This option allows you to specify arbitrary
63-
environment variables that are available for the process that will be launched
64-
inside of the container.
61+
Set environment variables e.g. key=value.
62+
This option allows you to specify arbitrary environment variables
63+
that are available for the process that will be launched inside of
64+
the container.
6565

6666
**--gid**=GID
6767
Gid for the process inside of container
@@ -84,6 +84,9 @@ inside of the container.
8484
The special *PATH* `host` removes any existing IPC namespace from the
8585
configuration.
8686

87+
**--label**=[]
88+
Add annotations to the configuration e.g. key=value.
89+
8790
**--mount**=*PATH*
8891
Use a mount namespace where *PATH* is an existing mount namespace file
8992
to join. The special *PATH* empty-string creates a new namespace.

0 commit comments

Comments
 (0)