forked from docker/app
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dec 18, 2018
1 parent
3f1c01e
commit 3d3f959
Showing
11 changed files
with
249 additions
and
99 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
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,18 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/docker/app/internal" | ||
cliplugins "github.com/docker/cli/cli-plugins" | ||
"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) | ||
}, cliplugins.Metadata{ | ||
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.