From 04440637d3e24ab3f8c30c0ef4b501ba55abb225 Mon Sep 17 00:00:00 2001 From: Amolith Date: Tue, 23 Dec 2025 22:40:53 -0700 Subject: [PATCH] feat(person): make last name optional Assisted-by: Claude Sonnet 4 via Crush --- cmd/person/add.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/person/add.go b/cmd/person/add.go index a1c1597b9b127d4edfc2544ec2274be9b0485c03..26e15d207102cef168f0f655d1b2f6deab06cfba 100644 --- a/cmd/person/add.go +++ b/cmd/person/add.go @@ -17,12 +17,13 @@ import ( // AddCmd creates a new person. Exported for potential use by shortcuts. var AddCmd = &cobra.Command{ - Use: "add FIRST LAST", + Use: "add FIRST [LAST]", Short: "Add a new person", Long: `Add a new person to the Lunatask relationship tracker. -Names are required. Use flags to set additional properties.`, - Args: cobra.ExactArgs(2), +First name is required; last name is optional. +Use flags to set additional properties.`, + Args: cobra.RangeArgs(1, 2), RunE: runAdd, } @@ -36,7 +37,11 @@ func init() { func runAdd(cmd *cobra.Command, args []string) error { firstName := args[0] - lastName := args[1] + + lastName := "" + if len(args) > 1 { + lastName = args[1] + } apiClient, err := client.New() if err != nil {