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:
+9
-6
@@ -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
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user