mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-22 21:50:47 -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
@@ -27,6 +27,11 @@ public class LogsCommand implements Callable<Integer> {
|
||||
}
|
||||
|
||||
protected LogsCommand(ProductProfile profile) {
|
||||
this(profile, new DockerClient());
|
||||
}
|
||||
|
||||
public LogsCommand(ProductProfile profile, DockerClient docker) {
|
||||
this.docker = docker;
|
||||
this.profile = profile;
|
||||
this.global = new GlobalOptions(profile);
|
||||
}
|
||||
@@ -43,15 +48,16 @@ public class LogsCommand implements Callable<Integer> {
|
||||
@Option(names = {"--service"}, description = "Filter to a specific service (not yet supported; requires server-side filtering)", paramLabel = "<name>")
|
||||
String service;
|
||||
|
||||
private final DockerClient docker;
|
||||
|
||||
@Override
|
||||
public Integer call() {
|
||||
Printer printer = global.printer();
|
||||
DockerClient docker = new DockerClient();
|
||||
|
||||
try {
|
||||
var info = docker.inspectContainer(global.container);
|
||||
if (info.isEmpty()) {
|
||||
printer.error("Container '" + global.container + "' not found.\nRun '" + profile.commandPrefix() + " start' to launch one.");
|
||||
printer.error("Container '" + global.container + "' not found.\nRun '" + profile.commandPrefix() + " start" + global.instanceSelector() + "' to launch one.");
|
||||
return 1;
|
||||
}
|
||||
} catch (DockerException e) {
|
||||
|
||||
Reference in new issue
Block a user