-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1652 from ijc/plugins-config
Add a field to the config file for plugin use.
- Loading branch information
Showing
12 changed files
with
249 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"auths": {}, | ||
"plugins": { | ||
"plugin1": { | ||
"data1": "some replacement string", | ||
"data3": "some additional string" | ||
}, | ||
"plugin3": { | ||
"data5": "a new plugin" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"auths": {}, | ||
"plugins": { | ||
"plugin1": { | ||
"data1": "some string", | ||
"data2": "42" | ||
}, | ||
"plugin2": { | ||
"data3": "some other string" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package cliplugins | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/docker/cli/cli/config" | ||
"gotest.tools/assert" | ||
"gotest.tools/icmd" | ||
) | ||
|
||
func TestConfig(t *testing.T) { | ||
run, cfg, cleanup := prepare(t) | ||
defer cleanup() | ||
|
||
cfg.SetPluginConfig("helloworld", "who", "Cambridge") | ||
err := cfg.Save() | ||
assert.NilError(t, err) | ||
|
||
res := icmd.RunCmd(run("helloworld")) | ||
res.Assert(t, icmd.Expected{ | ||
ExitCode: 0, | ||
Out: "Hello Cambridge!", | ||
}) | ||
|
||
cfg2, err := config.Load(filepath.Dir(cfg.GetFilename())) | ||
assert.NilError(t, err) | ||
assert.DeepEqual(t, cfg2.Plugins, map[string]map[string]string{ | ||
"helloworld": { | ||
"who": "Cambridge", | ||
"lastwho": "Cambridge", | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.