mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-22 21:50:47 -05:00
fix(cli): remove doctor --fix and services --mode, which did nothing (#53)
doctor --fix only hid the hint text and services --mode filtered nothing, because the server does not report service modes. Both flags are removed rather than kept as promises; doctor's summary now points at the Fix line under each failed check. services --mode can return once the server exposes service metadata (BL-065). Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
1 parent
771b353733
commit
1a7e84cd23
4 files changed
+40
-8
No files matched your search
@@ -660,7 +660,6 @@ floci wait -o json # machine-readable output
|
|||||||
```sh
|
```sh
|
||||||
floci doctor # run all checks
|
floci doctor # run all checks
|
||||||
floci doctor --check docker.installed # run a single check by name
|
floci doctor --check docker.installed # run a single check by name
|
||||||
floci doctor --fix # auto-fix fixable issues
|
|
||||||
floci doctor -o json # structured output for scripts
|
floci doctor -o json # structured output for scripts
|
||||||
|
|
||||||
floci gcp doctor # GCP-specific checks
|
floci gcp doctor # GCP-specific checks
|
||||||
|
|||||||
@@ -50,9 +50,6 @@ public class DoctorCommand implements Callable<Integer> {
|
|||||||
@Option(names = {"--check"}, description = "Run only a specific check by name", paramLabel = "<name>")
|
@Option(names = {"--check"}, description = "Run only a specific check by name", paramLabel = "<name>")
|
||||||
String checkName;
|
String checkName;
|
||||||
|
|
||||||
@Option(names = {"--fix"}, description = "Attempt to auto-fix fixable issues")
|
|
||||||
boolean fix;
|
|
||||||
|
|
||||||
/** The base environment checks every product runs, in order: Docker first, then server. */
|
/** The base environment checks every product runs, in order: Docker first, then server. */
|
||||||
public static List<Check> dockerChecks(ProductProfile profile) {
|
public static List<Check> dockerChecks(ProductProfile profile) {
|
||||||
return dockerChecks(profile, new CachingDockerClient());
|
return dockerChecks(profile, new CachingDockerClient());
|
||||||
@@ -182,7 +179,7 @@ public class DoctorCommand implements Callable<Integer> {
|
|||||||
printer.println(Ansi.green("No failures") + ", " + warns + " warning(s) to review.");
|
printer.println(Ansi.green("No failures") + ", " + warns + " warning(s) to review.");
|
||||||
} else {
|
} else {
|
||||||
printer.println(fails + " issue(s) found (" + fails + " fail, " + warns + " warn)."
|
printer.println(fails + " issue(s) found (" + fails + " fail, " + warns + " warn)."
|
||||||
+ (fix ? "" : " Run with --fix to auto-resolve fixable issues."));
|
+ " Follow the Fix line under each one.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return fails > 0 ? 1 : 0;
|
return fails > 0 ? 1 : 0;
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ public class ServicesCommand implements Callable<Integer> {
|
|||||||
this.global = new GlobalOptions(profile);
|
this.global = new GlobalOptions(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Option(names = {"--mode"}, description = "Filter mode: docker, in-process, all (default: all)", defaultValue = "all", paramLabel = "docker|in-process|all")
|
|
||||||
String mode;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer call() {
|
public Integer call() {
|
||||||
Printer printer = global.printer();
|
Printer printer = global.printer();
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package io.floci.cli.unit;
|
||||||
|
|
||||||
|
import io.floci.cli.FlociCli;
|
||||||
|
import io.floci.cli.config.ProfileStore;
|
||||||
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
import picocli.CommandLine;
|
||||||
|
import picocli.CommandLine.UnmatchedArgumentException;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BL-051, BL-052: doctor --fix fixed nothing and services --mode filtered nothing, so both were
|
||||||
|
* removed rather than kept as promises. They stay rejected in every product tree.
|
||||||
|
*/
|
||||||
|
class RemovedFlagsTest {
|
||||||
|
|
||||||
|
@TempDir
|
||||||
|
Path tempDir;
|
||||||
|
|
||||||
|
private CommandLine cli() {
|
||||||
|
return FlociCli.buildCommandLine(new ProfileStore(tempDir));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ParameterizedTest
|
||||||
|
@ValueSource(strings = {"aws", "gcp", "az", "oci"})
|
||||||
|
void doctorHasNoFixFlag(String product) {
|
||||||
|
assertThrows(UnmatchedArgumentException.class, () -> cli().parseArgs(product, "doctor", "--fix"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ParameterizedTest
|
||||||
|
@ValueSource(strings = {"aws", "gcp", "az", "oci"})
|
||||||
|
void servicesHasNoModeFlag(String product) {
|
||||||
|
assertThrows(UnmatchedArgumentException.class, () -> cli().parseArgs(product, "services", "--mode", "docker"));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user