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

Daniel5220026291d5
diff --git a/kernel/cli/cmd/root.go b/kernel/cli/cmd/root.go
index 41e17c43f0..53624342e1 100644
--- a/kernel/cli/cmd/root.go
+++ b/kernel/cli/cmd/root.go
@@ -37,9 +37,7 @@ var (
var rootCmd = &cobra.Command{
Use: "SiYuan-Kernel",
- Short: "SiYuan CLI",
Version: util.Ver,
- Long: `A command-line interface for SiYuan.`,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
// 确定工作目录
if exePath, err := os.Executable(); err == nil {
@@ -61,7 +59,10 @@ var rootCmd = &cobra.Command{
}
if _, err := os.Stat(workspacePath); os.IsNotExist(err) {
- return fmt.Errorf("workspace not found: %s", workspacePath)
+ return fmt.Errorf("directory not found: %s", workspacePath)
+ }
+ if !util.IsWorkspaceDir(workspacePath) {
+ return fmt.Errorf("not a valid workspace: %s", workspacePath)
}
util.Mode = "prod"
@@ -105,6 +106,9 @@ func findAppDir() string {
}
func init() {
+ rootCmd.Short = "SiYuan Kernel v" + util.Ver
+ rootCmd.Long = "SiYuan Kernel v" + util.Ver + ". Manage workspace data directly or start the HTTP server."
+
rootCmd.PersistentFlags().StringVarP(&workspacePath, "workspace", "w", "", "workspace path")
rootCmd.PersistentFlags().StringVarP(&outputFormat, "format", "f", "table", "output format: table | json")
}