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 {