This repository has been archived by the owner on Jun 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Port to use docker CLI plugins framework
docker/cli#1564 Since this pushes the actual command down to `docker-app app`, adjust the e2e tests with: $ sed -Eie 's/icmd\.RunCommand\(dockerApp,/icmd.RunCommand(dockerApp, "app",/g' e2e/*.go $ sed -Eie 's/exec.Command\(dockerApp,/exec.Command(dockerApp, "app",/g' e2e/*.go $ sed -Eie 's/\[\]string\{dockerApp,/\[\]string\{dockerApp, "app",/g' e2e/*.go (which might be precisely equivalent to `sed -Eie 's/dockerApp,/dockerApp, "app",/g' e2e/*.go`) Finally, the idiom in docker/cli (for better or worse) is to include an "Error: " prefix in the error string itself, rather than injecting it when printing. Since CLI plugins follow the behaviour of the CLI here it is necessary to prepend "Error: " to some messages. I've only done exactly those necessary to pass the e2e tests, a fuller audit is very likely required. Signed-off-by: Ian Campbell <ijc@docker.com>
- Loading branch information
Ian Campbell
committed
Jan 15, 2019
1 parent
f1a149b
commit c0b21e1
Showing
8 changed files
with
184 additions
and
92 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,21 +1,19 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/docker/app/internal" | ||
"github.com/docker/cli/cli-plugins/manager" | ||
"github.com/docker/cli/cli-plugins/plugin" | ||
"github.com/docker/cli/cli/command" | ||
"github.com/docker/docker/pkg/term" | ||
"github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func main() { | ||
// Set terminal emulation based on platform as required. | ||
stdin, stdout, stderr := term.StdStreams() | ||
logrus.SetOutput(stderr) | ||
|
||
dockerCli := command.NewDockerCli(stdin, stdout, stderr, nil) | ||
cmd := newRootCmd(dockerCli) | ||
if err := cmd.Execute(); err != nil { | ||
os.Exit(1) | ||
} | ||
plugin.Run(func(dockerCli command.Cli) *cobra.Command { | ||
return newRootCmd(dockerCli) | ||
}, manager.Metadata{ | ||
SchemaVersion: "0.1.0", | ||
Vendor: "Docker Inc.", | ||
Version: internal.Version, | ||
}) | ||
} |
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
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.