42 lines
687 B
Go
42 lines
687 B
Go
package remote
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"git.cryptic.systems/fh-trier/go-flucky/pkg/config"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var quiet bool
|
|
|
|
var listRemoteCmd = &cobra.Command{
|
|
Use: "list",
|
|
Short: "List Remove Servers",
|
|
Aliases: []string{"ls"},
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
// read configuration
|
|
fc, err := config.Read(cfg)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
|
|
// print all configured remote addresses on stdout
|
|
err = fc.PrintRemotes(os.Stdout)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
|
|
// save new configuration
|
|
err = config.Write(fc, cfg)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
remoteCmd.AddCommand(listRemoteCmd)
|
|
}
|