mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-24 22:37:56 -05:00
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:
1 parent
6b06382516
commit
de3ca7f171
16 files changed
+660
-20
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package io.floci.cli.output;
|
||||
|
||||
/**
|
||||
* The marks commands put in front of a line. Like {@link Ansi}, the choice is made once per
|
||||
* invocation: Unicode for a person at a terminal, plain ASCII with {@code --no-emoji}, when the
|
||||
* output is piped, or when {@code NO_COLOR} asks for undecorated output.
|
||||
*/
|
||||
public final class Glyphs {
|
||||
|
||||
/** One set of marks. */
|
||||
public record Set(String ok, String warn, String fail, String arrow) {}
|
||||
|
||||
public static final Set UNICODE = new Set("✓", "⚠", "✗", "→");
|
||||
public static final Set ASCII = new Set("+", "!", "x", "->");
|
||||
|
||||
private static Set current = UNICODE;
|
||||
|
||||
private Glyphs() {}
|
||||
|
||||
/** Switches to plain ASCII for the rest of this invocation; it cannot be switched back. */
|
||||
public static void plain() {
|
||||
current = ASCII;
|
||||
}
|
||||
|
||||
public static String ok() { return current.ok(); }
|
||||
public static String warn() { return current.warn(); }
|
||||
public static String fail() { return current.fail(); }
|
||||
public static String arrow() { return current.arrow(); }
|
||||
|
||||
public static boolean isPlain() { return current == ASCII; }
|
||||
}
|
||||
Reference in new issue
Block a user