fix: correct GetProperty bug, init to use .ax/, add default aliases, split e2e tests, add due date tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 01:58:48 +02:00
parent 5969a2591c
commit 921f4913f8
13 changed files with 1121 additions and 971 deletions
+9 -6
View File
@@ -12,14 +12,17 @@ import (
var initCmd = &cobra.Command{
Use: "init [path]", Short: "Initialize a new database", Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
dataRoot, err := store.FindDataRoot(".local", "share")
var dbPath string
if len(args) > 0 {
dataRoot = args[0]
} else if err != nil {
fmt.Fprintln(os.Stderr, "failed to find data dir:", err)
os.Exit(1)
dbPath = filepath.Join(args[0], "ax.db")
} else {
cwd, err := filepath.Abs(".")
if err != nil {
fmt.Fprintln(os.Stderr, "failed to get working directory:", err)
os.Exit(1)
}
dbPath = filepath.Join(cwd, ".ax", "ax.db")
}
dbPath := filepath.Join(dataRoot, "ax.db")
if _, err := os.Stat(dbPath); err == nil {
fmt.Fprintln(os.Stderr, "database already exists:", dbPath)
os.Exit(1)
+2 -2
View File
@@ -116,8 +116,8 @@ func PrintNode(w io.Writer, svc service.NodeService, n *models.Node, jsonOut boo
fmt.Fprintln(w, cDim.Sprint(" ───────────────────────────────"))
fmt.Fprintf(w, " Status: %s\n", render(statusRM, n.GetProperty("status"), false))
fmt.Fprintf(w, " Priority: %s\n", render(prioRM, n.GetProperty("prio"), false))
if n.DueDate != "" {
fmt.Fprintf(w, " Due: %s %s\n", iconCalendar, n.DueDate)
if n.DueDate != nil {
fmt.Fprintf(w, " Due: %s %s\n", iconCalendar, n.DueDate.Format("2006-01-02"))
}
fmt.Fprintf(w, " Created: %s\n", cDim.Sprint(n.CreatedAt))
fmt.Fprintf(w, " Updated: %s\n", cDim.Sprint(n.UpdatedAt))