mirror of
https://github.com/larksuite/cli.git
synced 2026-08-03 08:32:46 +08:00
docs: point the two brand parsers at each other
Removing extension's dependency on internal left the brand rule implemented twice, once per Brand type. The two cannot share code: extension is published as a standalone SDK and may not import internal, which is the constraint this branch exists to establish. Cross-reference them so a third brand is added to both rather than to whichever one the next author happens to open. Also correct the timestamp wrapper's comment, which has claimed "HH:mm" since before this branch while every implementation formatted seconds too.
This commit is contained in:
@@ -20,6 +20,11 @@ const (
|
||||
// It lives next to the Brand constants so every credential source resolves the
|
||||
// brand the same way; duplicating the rule per provider would let one copy
|
||||
// drift when the brand set changes.
|
||||
//
|
||||
// internal/core.ParseBrand applies the same rule to core.LarkBrand, which the
|
||||
// rest of the CLI uses. The two cannot share an implementation: this package is
|
||||
// published as a standalone SDK and may not import internal. Adding a brand
|
||||
// means changing both.
|
||||
func ParseBrand(value string) Brand {
|
||||
if strings.ToLower(strings.TrimSpace(value)) == string(BrandLark) {
|
||||
return BrandLark
|
||||
|
||||
@@ -17,6 +17,10 @@ const (
|
||||
|
||||
// ParseBrand normalizes a brand string (case-insensitive, whitespace-tolerant);
|
||||
// anything other than "lark" normalizes to BrandFeishu.
|
||||
//
|
||||
// extension/credential.ParseBrand applies the same rule to its own Brand type.
|
||||
// The two cannot share an implementation: extension is published as a standalone
|
||||
// SDK and may not import internal. Adding a brand means changing both.
|
||||
func ParseBrand(value string) LarkBrand {
|
||||
if strings.ToLower(strings.TrimSpace(value)) == "lark" {
|
||||
return BrandLark
|
||||
|
||||
@@ -24,7 +24,7 @@ func ResolveMentionKeys(text string, mentionMap map[string]string) string {
|
||||
}
|
||||
|
||||
// formatTimestamp converts a Unix timestamp string (seconds or milliseconds) to
|
||||
// "YYYY-MM-DD HH:mm" local time. Values with fewer than 10 digits are treated as
|
||||
// "YYYY-MM-DD HH:mm:ss" local time. Values with fewer than 10 digits are treated as
|
||||
// seconds; larger values are treated as milliseconds.
|
||||
// Returns empty string if the input is empty or unparseable.
|
||||
func formatTimestamp(ts string) string {
|
||||
|
||||
Reference in New Issue
Block a user