Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: Command Line Interface https://github.com/siyuan-note/siyuan/issues/17674

Daniel89368e01054d
diff --git a/kernel/cli/cmd/workspace.go b/kernel/cli/cmd/workspace.go
index ddd00ebb66..32415c75ac 100644
--- a/kernel/cli/cmd/workspace.go
+++ b/kernel/cli/cmd/workspace.go
@@ -21,6 +21,7 @@ import (
"fmt"
"os"
"path/filepath"
+ "strings"
"github.com/siyuan-note/siyuan/kernel/util"
@@ -43,22 +44,29 @@ var workspaceListCmd = &cobra.Command{
switch outputFormat {
case "json":
var items []map[string]any
+ seen := map[string]bool{}
for _, p := range paths {
+ key := strings.ToLower(p)
+ if seen[key] {
+ continue
+ }
+ seen[key] = true
items = append(items, map[string]any{
- "path": p,
- "closed": !util.IsWorkspaceLocked(p),
- "name": filepath.Base(p),
+ "path": p,
+ "name": filepath.Base(p),
})
}
data, _ := json.MarshalIndent(items, "", " ")
fmt.Println(string(data))
default:
+ seen := map[string]bool{}
for _, p := range paths {
- status := "open"
- if !util.IsWorkspaceLocked(p) {
- status = "locked"
+ key := strings.ToLower(p)
+ if seen[key] {
+ continue
}
- fmt.Printf("%-4s %s\n", status, p)
+ seen[key] = true
+ fmt.Println(p)
}
}
return nil