add aliases

This commit is contained in:
Erik Winter 2025-01-05 12:20:35 +01:00
parent 14b14578bd
commit 3ed1d348fe
2 changed files with 3 additions and 1 deletions

BIN
dist/plan vendored

Binary file not shown.

View File

@ -2,6 +2,7 @@ package command
import ( import (
"fmt" "fmt"
"slices"
"strings" "strings"
"time" "time"
@ -27,9 +28,10 @@ func NewAddArgs() AddArgs {
} }
func (aa AddArgs) Parse(main []string, fields map[string]string) (Command, error) { func (aa AddArgs) Parse(main []string, fields map[string]string) (Command, error) {
if len(main) == 0 || main[0] != "add" { if len(main) == 0 || !slices.Contains([]string{"add", "a", "new", "n"}, main[0]) {
return nil, ErrWrongCommand return nil, ErrWrongCommand
} }
main = main[1:] main = main[1:]
if len(main) == 0 { if len(main) == 0 {
return nil, fmt.Errorf("%w: title is required for add", ErrInvalidArg) return nil, fmt.Errorf("%w: title is required for add", ErrInvalidArg)