carlos / platform Public

cli: banner before account resolution; usage text follows the new default

The muted account line (and the chooser) belongs under 'using <console>
as <address>', not above it — a prompt with no console named yet is a
question with no context.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Paul Campbell 774253879a217d8d703a3155e9be9a1b9b2e93fc parent 2e80441
8 files changed, +28 −25
  • apps.go +5 −4
  • cli.go +5 −5
  • deploy.go +1 −1
  • fleets.go +8 −7
  • instances_cli.go +1 −1
  • restart.go +1 −1
  • retention.go +1 −1
  • store.go +6 −5
diff --git a/apps.go b/apps.go
index 740c804df..baee56d07 100644
--- a/apps.go
+++ b/apps.go
@@ -75,7 +75,8 @@ const appsUsage = `usage: carlos apps <create|place|delete|restore> [flags] <app
— but NO routes come back, not even the platform apex:
run "carlos add <host>" afterwards to serve it again.
- -account <sqid|name> account the app belongs to (default: ops) — resolved
+ -account <sqid|name> account the app belongs to (default: your only
+ account, or the configured/chosen one) — resolved
by the console against your own memberships; signed-in
mode only.
-account-id <sqid> account sqid, matched as a sqid ONLY — the only
@@ -199,8 +200,8 @@ func runAppsDelete(args []string) {
}
if mode == "signed-in" {
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
res, err := sess.trashApp(context.Background(), acct, app)
if err != nil {
log.Fatal(err)
@@ -319,8 +320,8 @@ func runAppsRestore(args []string) {
}
if mode == "signed-in" {
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
res, err := sess.restoreApp(context.Background(), acct, app)
if err != nil {
log.Fatal(err)
@@ -415,8 +416,8 @@ func runAppsCreate(args []string) {
"box-side way to hand a name to an address. To claim through a console instead,\n" +
"unset the store env and run: carlos auth login -console <url>")
}
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
res, err := sess.createApp(context.Background(), acct, strings.TrimSpace(*app), place2)
if err != nil {
log.Fatalf("apps create: %v", err)
diff --git a/cli.go b/cli.go
index 4fb490bef..6fe43b475 100644
--- a/cli.go
+++ b/cli.go
@@ -1962,8 +1962,8 @@ func runPromote(args []string) {
// flag silently do nothing.
log.Fatal("hotfix is an operator act — use the direct path (CARLOS_DEPLOYMENT_BUCKET) or the console")
}
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
res, err := sess.promote(context.Background(), acct, *app, version, channel)
if err != nil {
log.Fatal(err)
@@ -2038,8 +2038,8 @@ func runChannels(args []string) {
log.Fatal(err)
}
if sess != nil {
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
chans, err := sess.channels(context.Background(), acct, *app)
if err != nil {
log.Fatal(err)
@@ -2135,8 +2135,8 @@ func runVersionTarget(args []string) {
log.Fatal(err)
}
if sess != nil {
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
if fs.NArg() == 0 {
vt, err := sess.versionTarget(context.Background(), acct, *app)
if err != nil {
@@ -2280,8 +2280,8 @@ func runReleases(args []string) {
}
var rows []releaseRow
if sess != nil {
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
rels, err := sess.releases(context.Background(), acct, *app)
if err != nil {
log.Fatal(err)
@@ -2327,8 +2327,8 @@ func runRollback(args []string) {
log.Fatal(err)
}
if sess != nil {
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
if err := sess.rollback(context.Background(), acct, *app, fs.Arg(0)); err != nil {
log.Fatal(err)
}
diff --git a/deploy.go b/deploy.go
index 57da7555f..14327c5ac 100644
--- a/deploy.go
+++ b/deploy.go
@@ -59,8 +59,8 @@ func runDeploy(args []string) {
}
sess := requireDeployAPISession(*consoleFlag) // API-mode only: member verb
+ printUsing(stdout, sess) // printed HERE, once: runShipAPI's own banner is suppressed below
acct := resolvedAccount(sess, acctRaw, acctIDRaw)
- printUsing(stdout, sess) // printed HERE, once: runShipAPI's own banner is suppressed below
ctx := context.Background()
recs, _, _, err := sess.instanceList(ctx, acct, *app, "", "")
if err != nil {
diff --git a/fleets.go b/fleets.go
index 3a8ba2b20..efaa88cda 100644
--- a/fleets.go
+++ b/fleets.go
@@ -76,7 +76,8 @@ const fleetsUsage = `usage: carlos fleets <create|add-box|rotate-token|tag-box|d
list every fleet the account owns, with each box's label,
status and tags.
- -account <sqid|name> account the fleet belongs to (default: ops) —
+ -account <sqid|name> account the fleet belongs to (default: your only
+ account, or the configured/chosen one) —
resolved by the console against your own
memberships.
-account-id <sqid> account sqid, matched as a sqid ONLY — supersedes
@@ -170,8 +171,8 @@ func runFleetsCreate(args []string) {
bucketV := strings.TrimSpace(*bucket)
sess := fleetsSignedInSession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
f, err := sess.createFleet(context.Background(), acct, name, bucketV)
if err != nil {
log.Fatalf("fleets create: %v", err)
@@ -199,8 +200,8 @@ func runFleetsAddBox(args []string) {
}
sess := fleetsSignedInSession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
token, err := sess.addFleetBox(context.Background(), acct, fleet, label)
if err != nil {
log.Fatalf("fleets add-box: %v", err)
@@ -227,8 +228,8 @@ func runFleetsRotateToken(args []string) {
}
sess := fleetsSignedInSession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
token, err := sess.rotateFleetBoxToken(context.Background(), acct, fleet, label)
if err != nil {
log.Fatalf("fleets rotate-token: %v", err)
@@ -305,8 +306,8 @@ func runFleetsTagBox(args []string) {
}
sess := fleetsSignedInSession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
if err := sess.tagFleetBox(context.Background(), acct, fleet, label, tagsV); err != nil {
log.Fatalf("fleets tag-box: %v", err)
}
@@ -336,8 +337,8 @@ func runFleetsDetachBox(args []string) {
}
sess := fleetsSignedInSession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
if err := sess.detachFleetBox(context.Background(), acct, fleet, label); err != nil {
log.Fatalf("fleets detach-box: %v", err)
}
@@ -352,8 +353,8 @@ func runFleetsList(args []string) {
fs.Parse(args)
sess := fleetsSignedInSession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
fmt.Fprintf(stdout, "using %s as %s\n", sess.console, sess.address)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
fleets, err := sess.listFleets(context.Background(), acct)
if err != nil {
log.Fatalf("fleets ls: %v", err)
diff --git a/instances_cli.go b/instances_cli.go
index bcc5e93e4..cf5c6977a 100644
--- a/instances_cli.go
+++ b/instances_cli.go
@@ -118,8 +118,8 @@ func runInstancesEnable(args []string) {
}
seedReq = &argv
}
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
m, err := sess.instancesEnable(context.Background(), acct, *app, channelReq, seedReq)
if err != nil {
log.Fatalf("instances enable: %v", err)
diff --git a/restart.go b/restart.go
index 7a9173dfa..c9d628b9c 100644
--- a/restart.go
+++ b/restart.go
@@ -38,8 +38,8 @@ func runRestart(args []string) {
}
sess := requireRestartAPISession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
res, err := sess.restart(context.Background(), acct, name)
if err != nil {
log.Fatalf("restart: %v", err)
diff --git a/retention.go b/retention.go
index af24adda2..f4de48820 100644
--- a/retention.go
+++ b/retention.go
@@ -51,8 +51,8 @@ func runReleasesRetention(args []string) {
}
sess := requireRetentionAPISession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
ctx := context.Background()
switch {
case *off:
diff --git a/store.go b/store.go
index 06bf9e8a2..05075cefe 100644
--- a/store.go
+++ b/store.go
@@ -60,7 +60,8 @@ const storeUsage = `usage: carlos store <create|status|grant|rotate> [flags]
until -finish deletes it. A member verb: spends
nothing new, so there is no operator gate here.
- -account <sqid|name> account the app belongs to (default: ops) —
+ -account <sqid|name> account the app belongs to (default: your only
+ account, or the configured/chosen one) —
resolved by the console against your own
memberships; signed-in mode only.
-account-id <sqid> account sqid, matched as a sqid ONLY.
@@ -142,8 +143,8 @@ func runStoreCreate(args []string) {
}
sess := requireStoreAPISession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
res, err := sess.storeCreate(context.Background(), acct, name, strings.TrimSpace(*envPrefix))
if err != nil {
log.Fatalf("store create: %v", err)
@@ -166,8 +167,8 @@ func runStoreStatus(args []string) {
}
sess := requireStoreAPISession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
res, err := sess.storeGet(context.Background(), acct, name)
if err != nil {
log.Fatalf("store status: %v", err)
@@ -191,8 +192,8 @@ func runStoreGrant(args []string) {
}
sess := requireStoreAPISession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
res, err := sess.storeGrant(context.Background(), acct, name, strings.TrimSpace(*bucket))
if err != nil {
log.Fatalf("store grant: %v", err)
@@ -216,8 +217,8 @@ func runStoreRotate(args []string) {
}
sess := requireStoreAPISession(*consoleFlag)
- acct := resolvedAccount(sess, acctRaw, acctIDRaw)
printUsing(stdout, sess)
+ acct := resolvedAccount(sess, acctRaw, acctIDRaw)
res, err := sess.storeRotate(context.Background(), acct, name, *finish)
if err != nil {
log.Fatalf("store rotate: %v", err)