logout.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. Copyright 2020 Docker, Inc.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package logout
  14. import (
  15. "github.com/spf13/cobra"
  16. "github.com/docker/compose-cli/cli/mobycli"
  17. )
  18. // Command returns the login command
  19. func Command() *cobra.Command {
  20. cmd := &cobra.Command{
  21. Use: "logout [SERVER]",
  22. Short: "Log out from a Docker registry or cloud backend",
  23. Long: "Log out from a Docker registry or cloud backend.\nIf no server is specified, the default is defined by the daemon.",
  24. Args: cobra.MaximumNArgs(1),
  25. RunE: runLogout,
  26. }
  27. cmd.AddCommand(AzureLogoutCommand())
  28. return cmd
  29. }
  30. func runLogout(cmd *cobra.Command, args []string) error {
  31. mobycli.Exec(cmd.Root())
  32. return nil
  33. }