mirror of
https://github.com/containers/skopeo.git
synced 2025-06-23 21:38:02 +00:00
Keep options order in code and add missing bash completions
This commit is contained in:
parent
242b573f9a
commit
467b462b79
@ -93,10 +93,10 @@ func dockerImageFlags(global *globalOptions, shared *sharedImageOptions, flagPre
|
|||||||
f := fs.VarPF(newOptionalStringValue(&flags.credsOption), credsOptionAlias, "", "Use `USERNAME[:PASSWORD]` for accessing the registry")
|
f := fs.VarPF(newOptionalStringValue(&flags.credsOption), credsOptionAlias, "", "Use `USERNAME[:PASSWORD]` for accessing the registry")
|
||||||
f.Hidden = true
|
f.Hidden = true
|
||||||
}
|
}
|
||||||
|
fs.Var(newOptionalStringValue(&flags.registryToken), flagPrefix+"registry-token", "Provide a Bearer token for accessing the registry")
|
||||||
fs.StringVar(&flags.dockerCertPath, flagPrefix+"cert-dir", "", "use certificates at `PATH` (*.crt, *.cert, *.key) to connect to the registry or daemon")
|
fs.StringVar(&flags.dockerCertPath, flagPrefix+"cert-dir", "", "use certificates at `PATH` (*.crt, *.cert, *.key) to connect to the registry or daemon")
|
||||||
optionalBoolFlag(&fs, &flags.tlsVerify, flagPrefix+"tls-verify", "require HTTPS and verify certificates when talking to the container registry or daemon (defaults to true)")
|
optionalBoolFlag(&fs, &flags.tlsVerify, flagPrefix+"tls-verify", "require HTTPS and verify certificates when talking to the container registry or daemon (defaults to true)")
|
||||||
fs.BoolVar(&flags.noCreds, flagPrefix+"no-creds", false, "Access the registry anonymously")
|
fs.BoolVar(&flags.noCreds, flagPrefix+"no-creds", false, "Access the registry anonymously")
|
||||||
fs.Var(newOptionalStringValue(&flags.registryToken), flagPrefix+"registry-token", "Provide a Bearer token for accessing the registry")
|
|
||||||
return fs, &flags
|
return fs, &flags
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,9 +133,6 @@ func (opts *imageOptions) newSystemContext() (*types.SystemContext, error) {
|
|||||||
ctx.AuthFilePath = opts.shared.authFilePath
|
ctx.AuthFilePath = opts.shared.authFilePath
|
||||||
ctx.DockerDaemonHost = opts.dockerDaemonHost
|
ctx.DockerDaemonHost = opts.dockerDaemonHost
|
||||||
ctx.DockerDaemonCertPath = opts.dockerCertPath
|
ctx.DockerDaemonCertPath = opts.dockerCertPath
|
||||||
if opts.registryToken.present {
|
|
||||||
ctx.DockerBearerRegistryToken = opts.registryToken.value
|
|
||||||
}
|
|
||||||
if opts.dockerImageOptions.authFilePath.present {
|
if opts.dockerImageOptions.authFilePath.present {
|
||||||
ctx.AuthFilePath = opts.dockerImageOptions.authFilePath.value
|
ctx.AuthFilePath = opts.dockerImageOptions.authFilePath.value
|
||||||
}
|
}
|
||||||
@ -155,6 +152,9 @@ func (opts *imageOptions) newSystemContext() (*types.SystemContext, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if opts.registryToken.present {
|
||||||
|
ctx.DockerBearerRegistryToken = opts.registryToken.value
|
||||||
|
}
|
||||||
if opts.noCreds {
|
if opts.noCreds {
|
||||||
ctx.DockerAuthConfig = &types.DockerAuthConfig{}
|
ctx.DockerAuthConfig = &types.DockerAuthConfig{}
|
||||||
}
|
}
|
||||||
|
@ -68,11 +68,11 @@ func TestImageOptionsNewSystemContext(t *testing.T) {
|
|||||||
DockerCertPath: "/srv/cert-dir",
|
DockerCertPath: "/srv/cert-dir",
|
||||||
DockerInsecureSkipTLSVerify: types.OptionalBoolTrue,
|
DockerInsecureSkipTLSVerify: types.OptionalBoolTrue,
|
||||||
DockerAuthConfig: &types.DockerAuthConfig{Username: "creds-user", Password: "creds-password"},
|
DockerAuthConfig: &types.DockerAuthConfig{Username: "creds-user", Password: "creds-password"},
|
||||||
|
DockerBearerRegistryToken: "faketoken",
|
||||||
DockerDaemonCertPath: "/srv/cert-dir",
|
DockerDaemonCertPath: "/srv/cert-dir",
|
||||||
DockerDaemonHost: "daemon-host.example.com",
|
DockerDaemonHost: "daemon-host.example.com",
|
||||||
DockerDaemonInsecureSkipTLSVerify: true,
|
DockerDaemonInsecureSkipTLSVerify: true,
|
||||||
BigFilesTemporaryDir: "/srv",
|
BigFilesTemporaryDir: "/srv",
|
||||||
DockerBearerRegistryToken: "faketoken",
|
|
||||||
}, res)
|
}, res)
|
||||||
|
|
||||||
// Global/per-command tlsVerify behavior
|
// Global/per-command tlsVerify behavior
|
||||||
@ -180,12 +180,12 @@ func TestImageDestOptionsNewSystemContext(t *testing.T) {
|
|||||||
DockerCertPath: "/srv/cert-dir",
|
DockerCertPath: "/srv/cert-dir",
|
||||||
DockerInsecureSkipTLSVerify: types.OptionalBoolTrue,
|
DockerInsecureSkipTLSVerify: types.OptionalBoolTrue,
|
||||||
DockerAuthConfig: &types.DockerAuthConfig{Username: "creds-user", Password: "creds-password"},
|
DockerAuthConfig: &types.DockerAuthConfig{Username: "creds-user", Password: "creds-password"},
|
||||||
|
DockerBearerRegistryToken: "faketoken",
|
||||||
DockerDaemonCertPath: "/srv/cert-dir",
|
DockerDaemonCertPath: "/srv/cert-dir",
|
||||||
DockerDaemonHost: "daemon-host.example.com",
|
DockerDaemonHost: "daemon-host.example.com",
|
||||||
DockerDaemonInsecureSkipTLSVerify: true,
|
DockerDaemonInsecureSkipTLSVerify: true,
|
||||||
DirForceCompress: true,
|
DirForceCompress: true,
|
||||||
BigFilesTemporaryDir: "/srv",
|
BigFilesTemporaryDir: "/srv",
|
||||||
DockerBearerRegistryToken: "faketoken",
|
|
||||||
}, res)
|
}, res)
|
||||||
|
|
||||||
// Invalid option values in imageOptions
|
// Invalid option values in imageOptions
|
||||||
|
@ -140,11 +140,14 @@ _skopeo_delete() {
|
|||||||
|
|
||||||
_skopeo_layers() {
|
_skopeo_layers() {
|
||||||
local options_with_args="
|
local options_with_args="
|
||||||
|
--authfile
|
||||||
--creds
|
--creds
|
||||||
--cert-dir
|
--cert-dir
|
||||||
|
--registry-token
|
||||||
"
|
"
|
||||||
local boolean_options="
|
local boolean_options="
|
||||||
--tls-verify
|
--tls-verify
|
||||||
|
--no-creds
|
||||||
"
|
"
|
||||||
_complete_ "$options_with_args" "$boolean_options"
|
_complete_ "$options_with_args" "$boolean_options"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user