feat(cli): add --json, --no-emoji, config profile edit and a warning for servers too old for the CLI (#62)

* feat(cli): add --json, --no-emoji, config profile edit and a warning for servers too old for the CLI

--json is shorthand for --output json. Marks are plain ASCII with --no-emoji, when output is piped and under NO_COLOR. config profile edit opens a profile in VISUAL or EDITOR and checks it still reads. status and version warn on stderr when the AWS server is older than the minimum the CLI supports.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* feat(cli): keep the upgrade hint on the selected instance and read quoted editor commands

The old-server hint names the instance it is about and suggests a restart, which keeps that instance's settings. The update notice follows --no-emoji and NO_COLOR. VISUAL and EDITOR are split like a shell would, so a quoted path with spaces works.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* feat(cli): keep Windows paths in editor values and say what to do for a pinned image

A backslash in VISUAL or EDITOR is an escape only before a space or a quote, so Windows paths come through intact. The old-server hint explains that restart keeps a pinned tag and how to change it.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* feat(config): let profile edit open a profile that no longer parses

edit asked the store to parse the profile before opening it, so the one profile that needed repairing could not be opened. A file holding YAML's null is now reported as a profile without settings instead of failing with an exception.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-11 09:12:44 -05:00
1 parent 6b06382516
commit de3ca7f171
16 files changed
+660 -20

No files matched your search

+24 -1
View File
@@ -2,6 +2,7 @@ package io.floci.cli;
import io.floci.cli.docker.DockerClient;
import io.floci.cli.output.Ansi;
import io.floci.cli.output.Glyphs;
import io.floci.cli.output.OutputFormat;
import io.floci.cli.output.Printer;
import picocli.CommandLine.Model.CommandSpec;
@@ -61,6 +62,9 @@ public class GlobalOptions {
paramLabel = "text|json|yaml")
public OutputFormat output;
@Option(names = {"--json"}, description = "Shorthand for --output json")
public boolean json;
@Option(names = {"--quiet", "-q"}, description = "Suppress non-error output")
public boolean quiet;
@@ -70,6 +74,9 @@ public class GlobalOptions {
@Option(names = {"--no-color"}, description = "Disable ANSI colors")
public boolean noColor;
@Option(names = {"--no-emoji"}, description = "Plain ASCII marks instead of Unicode ones (the default when output is piped)")
public boolean noEmoji;
public GlobalOptions() {
this(ProductProfile.AWS);
}
@@ -131,7 +138,23 @@ public class GlobalOptions {
if (verbose) {
System.setProperty(VERBOSE_PROPERTY, "true");
}
return new Printer(System.out, System.err, output, quiet);
if (plainGlyphs(noEmoji, isStdoutTty(), System.getenv("NO_COLOR") != null)) {
Glyphs.plain();
}
return new Printer(System.out, System.err, format(), quiet);
}
/** The output format in effect: {@code --json} is {@code --output json} and wins over it. */
public OutputFormat format() {
return json ? OutputFormat.json : output;
}
/**
* Whether marks are printed as plain ASCII: on request, when nobody is looking at a terminal
* (a pipe, a file, CI logs), or when NO_COLOR asks for undecorated output.
*/
public static boolean plainGlyphs(boolean noEmoji, boolean terminal, boolean noColorEnv) {
return noEmoji || !terminal || noColorEnv;
}
// Inspects the container and derives the endpoint from its host port mapping.