feat: rename create and delete commands to add and del

This commit is contained in:
2026-03-29 19:46:43 +02:00
parent 68f4b67283
commit 535626d198
5 changed files with 23 additions and 23 deletions

View File

@@ -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 <title> [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
```

View File

@@ -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, "")

View File

@@ -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")
}

View File

@@ -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, "")
}

View File

@@ -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) {