bf9395e022
CI / license-header (push) Has been skipped
CI / e2e-dry-run (push) Has been skipped
CI / fast-gate (push) Failing after 0s
Test PR Label Logic / test-pr-labels (push) Failing after 1s
Skill Format Check / check-format (push) Failing after 2s
CI / security (push) Failing after 5s
CI / unit-test (push) Has been skipped
CI / lint (push) Has been skipped
CI / script-test (push) Has been skipped
CI / deterministic-gate (push) Has been skipped
CI / coverage (push) Has been skipped
CI / results (push) Has been cancelled
CI / deadcode (push) Has been cancelled
CI / e2e-live (push) Has been cancelled
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package config
|
|
|
|
import (
|
|
"github.com/larksuite/cli/internal/cmdutil"
|
|
"github.com/larksuite/cli/internal/core"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// NewCmdConfig creates the config command with subcommands.
|
|
func NewCmdConfig(f *cmdutil.Factory) *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "config",
|
|
Short: "Global CLI configuration management",
|
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
|
// Replicate rootCmd's PersistentPreRun behaviour: cobra stops at the first
|
|
// PersistentPreRun[E] found walking up the chain, so the root-level
|
|
// SilenceUsage=true would be skipped without this line.
|
|
cmd.SilenceUsage = true
|
|
// Pass "config" as a literal — cmd.Name() would return the subcommand name.
|
|
return f.RequireBuiltinCredentialProvider(cmd.Context(), "config")
|
|
},
|
|
}
|
|
cmdutil.DisableAuthCheck(cmd)
|
|
|
|
cmd.AddCommand(NewCmdConfigInit(f, nil))
|
|
cmd.AddCommand(NewCmdConfigBind(f, nil))
|
|
cmd.AddCommand(NewCmdConfigRemove(f, nil))
|
|
cmd.AddCommand(NewCmdConfigShow(f, nil))
|
|
cmd.AddCommand(NewCmdConfigDefaultAs(f))
|
|
cmd.AddCommand(NewCmdConfigStrictMode(f))
|
|
cmd.AddCommand(NewCmdConfigPolicy(f))
|
|
cmd.AddCommand(NewCmdConfigPlugins(f))
|
|
cmd.AddCommand(NewCmdConfigKeychainDowngrade(f))
|
|
return cmd
|
|
}
|
|
|
|
func parseBrand(value string) core.LarkBrand {
|
|
return core.ParseBrand(value)
|
|
}
|