From d987250844b54693b6f029eecb7b8baabf3f5386 Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:41:15 -0700 Subject: [PATCH 1/2] Notify user if missing flag args on create account --- internal/accounts/create.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/accounts/create.go b/internal/accounts/create.go index db8015462..1c552de71 100644 --- a/internal/accounts/create.go +++ b/internal/accounts/create.go @@ -57,12 +57,18 @@ var createCommand = &command.Command{ func create( _ []string, - _ command.GlobalFlags, - _ output.Logger, + globalFlags command.GlobalFlags, + logger output.Logger, flow flowkit.Services, state *flowkit.State, ) (command.Result, error) { if len(createFlags.Keys) == 0 { // if user doesn't provide any flags go into interactive mode + + // if user has flags, but doesn't provide any keys, notify them before switching into interactive mode + if len(createFlags.SigAlgo) > 0 || globalFlags.Network != "" { + logger.Info("Warning: You provided flags as arguments but no key. Switching to interactive mode.") + } + return createInteractive(state) } else { return createManual(state, flow) From 72a6b86c4b68a067fda2dde28fc62697ba648679 Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:48:02 -0700 Subject: [PATCH 2/2] Kill it if no key and flags --- internal/accounts/create.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/accounts/create.go b/internal/accounts/create.go index 1c552de71..ac87871a3 100644 --- a/internal/accounts/create.go +++ b/internal/accounts/create.go @@ -64,12 +64,12 @@ func create( ) (command.Result, error) { if len(createFlags.Keys) == 0 { // if user doesn't provide any flags go into interactive mode - // if user has flags, but doesn't provide any keys, notify them before switching into interactive mode if len(createFlags.SigAlgo) > 0 || globalFlags.Network != "" { - logger.Info("Warning: You provided flags as arguments but no key. Switching to interactive mode.") + return nil, fmt.Errorf("You provided flags, but no key. A key is required to create an account in manual mode. Remove flags if you'd like to use interactive mode.") + } else { + return createInteractive(state) } - return createInteractive(state) } else { return createManual(state, flow) }