Path: blob/main/components/local-app/cmd/config-get.go
2497 views
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package cmd56import (7"github.com/gitpod-io/local-app/pkg/config"8"github.com/gitpod-io/local-app/pkg/prettyprint"9"github.com/spf13/cobra"10)1112var configGetCmd = &cobra.Command{13Use: "get",14Short: "Get an individual config value in the config file",15RunE: func(cmd *cobra.Command, args []string) error {16cmd.SilenceUsage = true1718cfg := config.FromContext(cmd.Context())1920host := "not set"21organizationID := "not set"2223gpctx, ok := cfg.Contexts[cfg.ActiveContext]24if !ok {25gpctx = &config.ConnectionContext{}26} else {27host = gpctx.Host.Host28organizationID = gpctx.OrganizationID29}3031return WriteTabular([]struct {32Telemetry bool `header:"Telemetry"`33Autoupdate bool `header:"Autoupdate"`34Host string `header:"Host"`35OrganizationID string `header:"OrganizationID" print:"organization id"`36}{37{Telemetry: cfg.Telemetry.Enabled, Autoupdate: cfg.Autoupdate, Host: host, OrganizationID: organizationID},38}, configGetOpts.Format, prettyprint.WriterFormatNarrow)39},40}4142var configGetOpts struct {43Format formatOpts44}4546func init() {47configCmd.AddCommand(configGetCmd)48addFormatFlags(configGetCmd, &configGetOpts.Format)49}505152