From 46c7495e418ca64f47e309992eb5dea30fb56b7c Mon Sep 17 00:00:00 2001 From: cyberguru1 Date: Thu, 14 May 2026 19:35:04 -0500 Subject: [PATCH] litcli: default update expirationDate to -1 and make optional Set expirationDate default to -1, update positional argument usage and prepend "(optional)" to the flag usage string. --- cmd/litcli/accounts.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/litcli/accounts.go b/cmd/litcli/accounts.go index c9bc39f3..a67ece85 100644 --- a/cmd/litcli/accounts.go +++ b/cmd/litcli/accounts.go @@ -146,7 +146,7 @@ var updateAccountCommand = cli.Command{ Name: "update", ShortName: "u", Usage: "Update an existing off-chain account.", - ArgsUsage: "[id | label] new_expiration_date", + ArgsUsage: "[id | label] [new_expiration_date]", Description: "Updates an existing off-chain account and sets " + "a new expiration date and optionally a new label.", Flags: []cli.Flag{ @@ -167,10 +167,10 @@ var updateAccountCommand = cli.Command{ }, cli.Int64Flag{ Name: "new_expiration_date", - Usage: "The new expiration date of the account " + - "expressed in seconds since the unix epoch; " + - "-1 means do not update the expiration date; " + - "0 means it does not expire.", + Usage: "(optional) The new expiration date of " + + "the account expressed in seconds since the " + + "unix epoch; -1 means do not update the " + + "expiration date; 0 means it does not expire.", Value: -1, }, }, @@ -196,7 +196,7 @@ func updateAccount(cli *cli.Context) error { } var ( - expirationDate int64 + expirationDate int64 = -1 ) switch { case cli.IsSet("new_expiration_date"): @@ -210,6 +210,9 @@ func updateAccount(cli *cli.Context) error { } args = args.Tail() } + if args.Present() { + return fmt.Errorf("too many arguments provided") + } req := &litrpc.UpdateAccountRequest{ Id: id,