Files
floci-cli/src/main/java/io/floci/cli/commands/gcp/GcpCommand.java
T
Hector Ventura fa306b38a6 feat(reset): add floci reset to delete every resource in a running emulator (#55)
* 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>
2026-10-10 22:07:41 -05:00

43 lines
1.5 KiB
Java

package io.floci.cli.commands.gcp;
import io.floci.cli.commands.CompletionCommand;
import io.floci.cli.commands.gcp.config.GcpConfigCommand;
import io.floci.cli.commands.gcp.snapshot.GcpSnapshotCommand;
import picocli.CommandLine;
import picocli.CommandLine.*;
@Command(
name = "gcp",
description = "Manage the Floci GCP emulator (floci-gcp)%n%n" +
" floci gcp start — launch the container%n" +
" floci gcp stop — stop the container%n" +
" floci gcp status — show health and version%n" +
" floci gcp doctor — diagnose environment issues%n" +
" floci gcp env — print GCP environment variables%n",
mixinStandardHelpOptions = true,
subcommands = {
GcpStartCommand.class,
GcpStopCommand.class,
GcpRestartCommand.class,
GcpStatusCommand.class,
GcpLogsCommand.class,
GcpWaitCommand.class,
GcpVersionCommand.class,
GcpServicesCommand.class,
GcpResetCommand.class,
GcpDoctorCommand.class,
GcpEnvCommand.class,
GcpConfigCommand.class,
GcpSnapshotCommand.class,
CompletionCommand.class,
HelpCommand.class
}
)
public class GcpCommand implements Runnable {
@Override
public void run() {
new CommandLine(this).usage(System.out);
}
}