add aliases
This commit is contained in:
parent
14b14578bd
commit
3ed1d348fe
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue