code: func NewLoginCommand(dockerCli command.Cli) *cobra.Command {
  	var opts loginOptions
  
  	cmd := &cobra.Command{
  		Use:   "login [OPTIONS] [SERVER]",
  		Short: "Log in to a Docker registry",
  		Long:  "Log in to a Docker registry.\nIf no server is specified, the default is defined by the daemon.",
  		Args:  cli.RequiresMaxArgs(1),
  		RunE: func(cmd *cobra.Command, args []string) error {
  			if len(args) > 0 {
  				opts.serverAddress = args[0]
  			}
  			return runLogin(dockerCli, opts)
  		},
  	}
  
  	flags := cmd.Flags()
  
  	flags.StringVarP(&opts.user, "username", "u", "", "Username")
  	flags.StringVarP(&opts.password, "password", "p", "", "Password")
  	flags.BoolVarP(&opts.passwordStdin, "password-stdin", "", false, "Take the password from stdin")
  
  	return cmd
  }
docs: // NewLoginCommand creates a new `docker login` command