mirror of https://github.com/docker/cli.git
Add "src" alias for `--secret`
This patch adds a "src" alias for `--secret` to be consistent with `--mount`. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
438279688c
commit
e7020eefd0
|
@ -50,7 +50,7 @@ func (o *SecretOpt) Set(value string) error {
|
||||||
|
|
||||||
value := parts[1]
|
value := parts[1]
|
||||||
switch key {
|
switch key {
|
||||||
case "source":
|
case "source", "src":
|
||||||
options.Source = value
|
options.Source = value
|
||||||
case "target":
|
case "target":
|
||||||
tDir, _ := filepath.Split(value)
|
tDir, _ := filepath.Split(value)
|
||||||
|
|
|
@ -35,6 +35,18 @@ func TestSecretOptionsSourceTarget(t *testing.T) {
|
||||||
assert.Equal(t, req.Target, "testing")
|
assert.Equal(t, req.Target, "testing")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSecretOptionsShorthand(t *testing.T) {
|
||||||
|
var opt SecretOpt
|
||||||
|
|
||||||
|
testCase := "src=foo,target=testing"
|
||||||
|
assert.NilError(t, opt.Set(testCase))
|
||||||
|
|
||||||
|
reqs := opt.Value()
|
||||||
|
assert.Equal(t, len(reqs), 1)
|
||||||
|
req := reqs[0]
|
||||||
|
assert.Equal(t, req.Source, "foo")
|
||||||
|
}
|
||||||
|
|
||||||
func TestSecretOptionsCustomUidGid(t *testing.T) {
|
func TestSecretOptionsCustomUidGid(t *testing.T) {
|
||||||
var opt SecretOpt
|
var opt SecretOpt
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue