github.com/chipaca/snappy@v0.0.0-20210104084008-1f06296fe8ad/cmd/snap/cmd_logout.go (about)

     1  // -*- Mode: Go; indent-tabs-mode: t -*-
     2  
     3  /*
     4   * Copyright (C) 2015-2016 Canonical Ltd
     5   *
     6   * This program is free software: you can redistribute it and/or modify
     7   * it under the terms of the GNU General Public License version 3 as
     8   * published by the Free Software Foundation.
     9   *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
    14   *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17   *
    18   */
    19  
    20  package main
    21  
    22  import (
    23  	"github.com/jessevdk/go-flags"
    24  
    25  	"github.com/snapcore/snapd/i18n"
    26  )
    27  
    28  type cmdLogout struct {
    29  	clientMixin
    30  }
    31  
    32  var shortLogoutHelp = i18n.G("Log out of snapd and the store")
    33  
    34  var longLogoutHelp = i18n.G(`
    35  The logout command logs the current user out of snapd and the store.
    36  `)
    37  
    38  func init() {
    39  	addCommand("logout",
    40  		shortLogoutHelp,
    41  		longLogoutHelp,
    42  		func() flags.Commander {
    43  			return &cmdLogout{}
    44  		}, nil, nil)
    45  }
    46  
    47  func (cmd *cmdLogout) Execute(args []string) error {
    48  	if len(args) > 0 {
    49  		return ErrExtraArgs
    50  	}
    51  
    52  	return cmd.client.Logout()
    53  }