mirror of
https://github.com/larksuite/cli.git
synced 2026-07-18 17:44:32 +08:00
Port changes from feat/strict-mode-identity-filter_3 branch: - Add strict mode for identity filtering and configuration - Add profile management commands (add/list/remove/rename/use) - Add credential extension framework (registry, env provider) - Add VFS abstraction layer - Refactor factory default and client options - Update shortcuts to use new credential and validation patterns Change-Id: I8c104c6b147e1901d94aefcefe35a174932c742b Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
875 B
Go
31 lines
875 B
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"errors"
|
|
"io"
|
|
|
|
"github.com/larksuite/cli/internal/cmdutil"
|
|
"github.com/spf13/pflag"
|
|
)
|
|
|
|
// BootstrapInvocationContext extracts global invocation options before
|
|
// the real command tree is built, so provider-backed config resolution sees
|
|
// the correct profile from the start.
|
|
func BootstrapInvocationContext(args []string) (cmdutil.InvocationContext, error) {
|
|
var globals GlobalOptions
|
|
|
|
fs := pflag.NewFlagSet("bootstrap", pflag.ContinueOnError)
|
|
fs.ParseErrorsAllowlist.UnknownFlags = true
|
|
fs.SetInterspersed(true)
|
|
fs.SetOutput(io.Discard)
|
|
RegisterGlobalFlags(fs, &globals)
|
|
|
|
if err := fs.Parse(args); err != nil && !errors.Is(err, pflag.ErrHelp) {
|
|
return cmdutil.InvocationContext{}, err
|
|
}
|
|
return cmdutil.InvocationContext{Profile: globals.Profile}, nil
|
|
}
|