fix(cli): keep the selected instance in the commands that hints suggest

Commands printed by errors, env and doctor now carry --profile, --container and
an explicit --endpoint, so pasting one acts on the same instance. After a failed
pull, the suggested start also keeps the --port, --image, --persist, --services
and --namespace you typed.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura committed 2026-11-03 23:53:22 -06:00
1 parent ac52515471
commit b0d4a4eb31
24 files changed
+247 -44

No files matched your search

@@ -68,6 +68,7 @@ public class AzEnvCommand implements Callable<Integer> {
paramLabel = "<shell>")
String shell;
private final DockerClient docker;
private final Path stateRoot;
private final AzSetupCommand.CertSource certSource;
@@ -81,6 +82,11 @@ public class AzEnvCommand implements Callable<Integer> {
* each instance's config dir and CA; {@code certSource} reads the running server's CA.
*/
public AzEnvCommand(Path stateRoot, AzSetupCommand.CertSource certSource) {
this(stateRoot, certSource, new DockerClient());
}
public AzEnvCommand(Path stateRoot, AzSetupCommand.CertSource certSource, DockerClient docker) {
this.docker = docker;
this.stateRoot = stateRoot;
this.certSource = certSource;
}
@@ -92,7 +98,7 @@ public class AzEnvCommand implements Callable<Integer> {
printer.error(ShellExport.unsupported(shell));
return 2;
}
String effectiveEndpoint = global.resolvedEndpoint(new DockerClient());
String effectiveEndpoint = global.resolvedEndpoint(docker);
int port = extractPort(effectiveEndpoint);
boolean sdkVarsMode = "sdk-vars".equals(format) || serviceFilter != null;
@@ -121,7 +127,7 @@ public class AzEnvCommand implements Callable<Integer> {
printer.println(ShellExport.formatExport(shell, "AZURE_STORAGE_CONNECTION_STRING", connStr));
printAzCliVars(printer, azCliVars);
printer.println("");
printer.println(Ansi.gray("# Run: " + ShellExport.loadHint(shell, "floci az env")));
printer.println(Ansi.gray("# Run: " + ShellExport.loadHint(shell, "floci az env" + global.instanceSelector())));
} else {
printer.println(ShellExport.formatExport(shell, "AZURE_STORAGE_ACCOUNT", account));
printer.println(ShellExport.formatExport(shell, "AZURE_STORAGE_KEY", DEV_KEY));
@@ -130,7 +136,7 @@ public class AzEnvCommand implements Callable<Integer> {
}
printAzCliVars(printer, azCliVars);
printer.println("");
printer.println(Ansi.gray("# Run: " + ShellExport.loadHint(shell, "floci az env --format sdk-vars")));
printer.println(Ansi.gray("# Run: " + ShellExport.loadHint(shell, "floci az env --format sdk-vars" + global.instanceSelector())));
}
return 0;