From 535626d198e1c5baebcb4e5eb28a33b1397631cc Mon Sep 17 00:00:00 2001 From: Elias Kohout Date: Sun, 29 Mar 2026 19:46:43 +0200 Subject: [PATCH] feat: rename create and delete commands to add and del --- README.md | 18 +++++++++--------- cmd/{create.go => add.go} | 12 ++++++------ cmd/alias.go | 6 +++--- cmd/{delete.go => del.go} | 8 ++++---- service/fileconfig.go | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) rename cmd/{create.go => add.go} (86%) rename cmd/{delete.go => del.go} (82%) diff --git a/README.md b/README.md index cf18f15..382a7b1 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,10 @@ go build -o ax . ax init . # Create an issue -ax create "Implement feature X" --tag backend --prio high +ax add "Implement feature X" --tag backend --prio high # Create with relations -ax create "Fix bug in auth" --rel blocks:abc12 +ax add "Fix bug in auth" --rel blocks:abc12 # List open issues ax list --status open @@ -55,7 +55,7 @@ ax alias mywork "list --namespace myproject --status open" --desc "My project ta Create a new `.ax.db` database in the specified directory (default: current). -### `ax create [flags]` +### `ax add <title> [flags]` Create a new node. @@ -108,7 +108,7 @@ Query and list nodes. Open node content in `$EDITOR`. -### `ax delete <id> [-f|--force]` +### `ax del <id> [-f|--force]` Delete a node. Prompts for confirmation unless `--force`. @@ -163,10 +163,10 @@ Relations connect nodes together: ```bash # Create subtask -ax create "Write tests" --rel subtask:abc12 +ax add "Write tests" --rel subtask:abc12 # Block an issue -ax create "Fix login" --rel blocks:def34 +ax add "Fix login" --rel blocks:def34 # Assign to user ax update abc12 --rel assignee:alice @@ -178,10 +178,10 @@ Tags are flexible labels. Tags with pattern `_key::value` are properties: ```bash # Regular tag -ax create "Task" --tag backend +ax add "Task" --tag backend # Property tags (set via flags) -ax create "Task" --type issue --status open --prio high +ax add "Task" --type issue --status open --prio high # Equivalent to: --tag _type::issue --tag _status::open --tag _prio::high ``` @@ -199,7 +199,7 @@ ax create "Task" --type issue --status open --prio high Use `@username` in title or content to automatically add to user's inbox: ```bash -ax create "Review PR @alice" --content "@bob please check" +ax add "Review PR @alice" --content "@bob please check" # Both alice and bob get this in their inbox ``` diff --git a/cmd/create.go b/cmd/add.go similarity index 86% rename from cmd/create.go rename to cmd/add.go index 554085e..29df469 100644 --- a/cmd/create.go +++ b/cmd/add.go @@ -16,8 +16,8 @@ import ( var cDue, cContent string var cTags, cRels []string -var createCmd = &cobra.Command{ - Use: "create <title>", Short: "Create a new node", Args: cobra.ExactArgs(1), +var addCmd = &cobra.Command{ + Use: "add <title>", Short: "Create a new node", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { d, err := db.GetDB() if err != nil { @@ -59,10 +59,10 @@ var createCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(createCmd) - addPropertyFlags(createCmd) - createCmd.Flags().Set("type", "issue") - f := createCmd.Flags() + rootCmd.AddCommand(addCmd) + addPropertyFlags(addCmd) + addCmd.Flags().Set("type", "issue") + f := addCmd.Flags() f.StringVar(&cDue, "due", "", "") f.StringVar(&cContent, "content", "", "") f.StringArrayVar(&cTags, "tag", nil, "") diff --git a/cmd/alias.go b/cmd/alias.go index 61e6289..3fb7a10 100644 --- a/cmd/alias.go +++ b/cmd/alias.go @@ -38,8 +38,8 @@ var aliasCmd = &cobra.Command{ }, } -var aliasDeleteCmd = &cobra.Command{ - Use: "delete <name>", Short: "Delete an alias", Args: cobra.ExactArgs(1), +var aliasDelCmd = &cobra.Command{ + Use: "del <name>", Short: "Delete an alias", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { if err := cfg.DeleteAlias(args[0]); err != nil { fmt.Fprintln(os.Stderr, err) @@ -51,6 +51,6 @@ var aliasDeleteCmd = &cobra.Command{ func init() { rootCmd.AddCommand(aliasCmd) - aliasCmd.AddCommand(aliasDeleteCmd) + aliasCmd.AddCommand(aliasDelCmd) aliasCmd.Flags().StringVar(&aliasDesc, "desc", "", "description for the alias") } diff --git a/cmd/delete.go b/cmd/del.go similarity index 82% rename from cmd/delete.go rename to cmd/del.go index 56e7ab6..f1f16e3 100644 --- a/cmd/delete.go +++ b/cmd/del.go @@ -13,8 +13,8 @@ import ( ) var dForce bool -var deleteCmd = &cobra.Command{ - Use: "delete <id>", Short: "Delete a node", Args: cobra.ExactArgs(1), +var delCmd = &cobra.Command{ + Use: "del <id>", Short: "Delete a node", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { d, err := db.GetDB() if err != nil { @@ -46,6 +46,6 @@ var deleteCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(deleteCmd) - deleteCmd.Flags().BoolVarP(&dForce, "force", "f", false, "") + rootCmd.AddCommand(delCmd) + delCmd.Flags().BoolVarP(&dForce, "force", "f", false, "") } diff --git a/service/fileconfig.go b/service/fileconfig.go index 7aeb9d6..6514c65 100644 --- a/service/fileconfig.go +++ b/service/fileconfig.go @@ -20,7 +20,7 @@ type fileConfig struct { var defaultAliases = []*Alias{ {Name: "mine", Command: "list --assignee $me --tag _status::open", Description: "Show open tasks assigned to you"}, {Name: "due", Command: "list --tag _status::open --tag _due", Description: "Show open tasks with due dates"}, - {Name: "new", Command: "create $@", Description: "Create a new task"}, + {Name: "new", Command: "add $@", Description: "Create a new task"}, } func LoadConfig() (Config, error) {