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>
When restart has removed the old container and the new one does not come up, it
now prints a start command with the same port, image, persist dir, services and
namespace. When the new container is running but did not become ready, it says to
check logs and run wait instead, because start refuses a running container.
The commands name their tree, because a bare floci follows the configured default
product. They keep a typed --endpoint, and --persist prints the directory a local
daemon would mount, so a retry from another directory finds the same state.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
status reported endpoint null and exited 1 for a healthy server when FLOCI_ENDPOINT equalled the product default, because its check ignored the environment while the published port was skipped in favour of it. Addresses the review of #75.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
status no longer probes the default instance for a named container with no known
endpoint, and env, services, snapshot and az setup exit 1 with the next step
instead of acting on it. wait keeps looking for the container until --timeout, and
doctor and version still run. A profile's port is used before its container
starts, and an endpoint from --endpoint, FLOCI_ENDPOINT or another host beats a
local container's published port.
BREAKING CHANGE: in status -o json, endpoint is null when the selected container
has no known endpoint. env, services, snapshot and az setup exit 1 in that case,
where they used to use the default endpoint. An --endpoint or FLOCI_ENDPOINT on
the default port is now honoured even when a local container publishes another
port.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* 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>
* feat(reset): add floci reset to delete every resource in a running emulator
floci reset (and floci gcp/az/oci reset) calls the emulator's state reset endpoint, so a test run can start clean without restarting the container. It asks for confirmation on a terminal; --yes skips the prompt and is required when there is no terminal. A server without the endpoint (floci-az today) gets a 'not available' message.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* feat(reset): never guess which server to reset
A typed --endpoint is used as given instead of being replaced by a local container's port, and a container the user selected has to be found running: a missing or stopped one resets nothing rather than falling back to the default instance. The confirmation goes through a seam, with tests for every answer.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* feat(reset): stop when a selected container publishes no port for the emulator
A selected container that is running without a matching published port has nothing to be found by, and the configured endpoint may be another instance.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* feat(reset): find a selected instance by the emulator's port, not the configured host port
A profile for an instance on its own host port names that port in its endpoint, while the container still listens on the emulator's; reset matched the wrong one and refused such instances.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* fix(cli): keep wait's spinner out of -o json, reject bad durations and make --verbose work
wait draws its spinner only for text output on a terminal and clears it before the result; --timeout values that are not a positive number with ms, s, m or h exit 2 with a hint instead of a stack trace; --verbose now echoes each docker command to stderr and prints stack traces for errors.
* fix(cli): reject durations that overflow and pin the spinner rule on a terminal
A duration is checked for sign before it is converted and the conversion is overflow-checked, so -9223372036854775807s no longer wraps to a positive timeout. wait takes its terminal check through a seam, with tests for json, yaml and text output on a terminal.
* refactor!: unify the four product command trees behind ProductProfile
Every shared command now has ONE implementation in commands/,
parameterized by ProductProfile (the single source of per-product
config: endpoint, container, image, env prefix, control prefix,
display name). The gcp/az/oci command classes become ~8-line shims
(GcpStartCommand extends StartCommand { super(ProductProfile.GCP); })
that carry only their per-product help description; the three
near-identical *GlobalOptions clones are deleted. Each product tree
drops from ~1,360 to ~530 lines and copy-drift becomes impossible.
Mechanics: per-product option defaults are constructor-set field
values rendered in help via ${DEFAULT-VALUE} (annotation defaults are
compile-time constants); commands pre-initialize their GlobalOptions
mixin with the profile (picocli uses a non-null mixin field instance
as-is). Verified against a captured baseline of 480 CLI outputs
(every --help x 5 trees, env/status/doctor JSON, exit codes, routing)
plus new pinning tests: ProductProfileTest, ProductTreesParsingTest,
DoctorCheckListTest, GlobalOptionsTest.
Behavior changes, all deliberate:
- snapshot commands in gcp/az/oci trees now perform the real
/snapshots API calls with graceful degradation and exit 1 while the
server lacks the endpoints (previously: note + exit 0)
- product logs/services gained --service/--mode, and services now
resolves the endpoint from the container port mapping in all trees
- the AWS tree brands itself 'Floci AWS' in banners and help,
matching the other products
- snapshot errors link the product issue tracker instead of TODO.md
- completion generates from spec.root() instead of a hardcoded
FlociCli instance (output unchanged)
BREAKING CHANGE: 'floci gcp|az|oci snapshot export/import' (and bare
'floci snapshot ...' with a non-AWS default product) now exit 1
instead of 0 while server-side snapshot support is pending; CI
scripts relying on the silent success of stubbed snapshot commands
will fail.
* fix: snapshot save/load/list/delete resolve the container host port
Same port auto-detection status/services/wait use — a container started
with --port <n> is now reachable by the snapshot commands without an
explicit --endpoint. Applies to all four trees via the unified base
commands.