mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-23 14:10:50 -05:00
fix(cli): keep the selected instance in the commands that hints suggest (#74)
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. The env load hint adds -o text after a profile, which may set output: json, and quotes values for the shell it is for. A value containing a line break prints as a placeholder, because the hint is a comment in the output people feed to eval. Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
1 parent
a319e2d242
commit
882c0ea7be
25 files changed
+355
-43
No files matched your search
@@ -41,6 +41,12 @@ public class GcpEnvCommand implements Callable<Integer> {
|
||||
paramLabel = "<shell>")
|
||||
String shell;
|
||||
|
||||
private final DockerClient docker;
|
||||
|
||||
public GcpEnvCommand() { this(new DockerClient()); }
|
||||
|
||||
public GcpEnvCommand(DockerClient docker) { this.docker = docker; }
|
||||
|
||||
@Override
|
||||
public Integer call() {
|
||||
Printer printer = global.printer();
|
||||
@@ -48,7 +54,7 @@ public class GcpEnvCommand implements Callable<Integer> {
|
||||
printer.error(ShellExport.unsupported(shell));
|
||||
return 2;
|
||||
}
|
||||
String effectiveEndpoint = global.resolvedEndpoint(new DockerClient());
|
||||
String effectiveEndpoint = global.resolvedEndpoint(docker);
|
||||
String host = extractHost(effectiveEndpoint);
|
||||
int port = extractPort(effectiveEndpoint);
|
||||
String hostPort = host + ":" + port;
|
||||
@@ -71,7 +77,7 @@ public class GcpEnvCommand implements Callable<Integer> {
|
||||
printer.println(ShellExport.formatExport(shell, entry.getKey(), entry.getValue()));
|
||||
}
|
||||
printer.println("");
|
||||
printer.println(Ansi.gray("# Run: " + ShellExport.loadHint(shell, "floci gcp env")));
|
||||
printer.println(Ansi.gray("# Run: " + ShellExport.loadHint(shell, "floci gcp env" + global.envLoadFlags(shell))));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user