Skip to content

Commit 0bc78bb

Browse files
committed
feat(cmd/rofl): Allow explicit account override
1 parent c53020f commit 0bc78bb

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

cmd/common/selector.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ type NPASelection struct {
4343
ParaTimeName string
4444
ParaTime *config.ParaTime
4545

46-
AccountName string
47-
Account *cliConfig.Account
46+
AccountName string
47+
Account *cliConfig.Account
48+
AccountSetExplicitly bool
4849
}
4950

5051
// GetNPASelection returns the user-selected network/ParaTime/account combination.
@@ -78,6 +79,7 @@ func GetNPASelection(cfg *cliConfig.Config) *NPASelection {
7879
s.AccountName = cfg.Wallet.Default
7980
if selectedAccount != "" {
8081
s.AccountName = selectedAccount
82+
s.AccountSetExplicitly = true
8183
}
8284
if s.AccountName != "" {
8385
accCfg, err := LoadAccountConfig(cfg, s.AccountName)

cmd/rofl/common/manifest.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ func MaybeLoadManifestAndSetNPA(cfg *cliConfig.Config, npa *common.NPASelection,
7676
}
7777
npa.ParaTimeName = d.ParaTime
7878
}
79-
switch d.Admin {
80-
case "":
79+
switch {
80+
case d.Admin == "":
81+
// No admin in manifest, leave unchanged.
82+
case npa.AccountSetExplicitly:
83+
// Account explicitly overridden on the command line, leave unchanged.
8184
default:
8285
accCfg, err := common.LoadAccountConfig(cfg, d.Admin)
8386
switch {

0 commit comments

Comments
 (0)