mirror of
https://github.com/larksuite/cli.git
synced 2026-07-03 14:02:43 +08:00
* feat(config): add command to explicitly dowgrade keychain storage to use file * feat(config): add command to explicitly dowgrade keychain storage to use file * fix(lint): use the corresponding vfs.Xxx() from internal/vfs * fix: optimize scanError && osReadDir * opt: remove CmdConfigKeychainDowngrade wrapper & runF * fix: add downgrade hint on keychain blocked * opt: remove redundant ErrOrphanedCredentials * opt: fix suggested concurrent platformSet issue
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)
|
|
}
|