version.go 498 B

12345678910111213141516171819202122232425
  1. package commands
  2. import (
  3. "fmt"
  4. "github.com/spf13/cobra"
  5. )
  6. var (
  7. // Version is the git tag that this was built from.
  8. Version = "unknown"
  9. // GitCommit is the commit that this was built from.
  10. GitCommit = "unknown"
  11. )
  12. func VersionCommand() *cobra.Command {
  13. return &cobra.Command{
  14. Use: "version",
  15. Short: "Show version.",
  16. RunE: func(cmd *cobra.Command, args []string) error {
  17. fmt.Fprintf(cmd.OutOrStdout(), "Docker ECS plugin %s (%s)\n", Version, GitCommit)
  18. return nil
  19. },
  20. }
  21. }