mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-22 21:50:47 -05:00
chore: first commit
This commit is contained in:
69 files changed
+3697
No files matched your search
@@ -0,0 +1,72 @@
|
||||
package io.floci.cli;
|
||||
|
||||
import io.floci.cli.commands.*;
|
||||
import io.floci.cli.commands.config.ConfigCommand;
|
||||
import io.floci.cli.commands.snapshot.SnapshotCommand;
|
||||
import io.floci.cli.output.Ansi;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.*;
|
||||
|
||||
@Command(
|
||||
name = "floci",
|
||||
description = "Manage your local Floci AWS emulator%n%n" +
|
||||
" floci start — launch the container%n" +
|
||||
" floci stop — stop the container%n" +
|
||||
" floci status — show health and version%n" +
|
||||
" floci doctor — diagnose environment issues%n" +
|
||||
" floci logs — stream container logs%n",
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = FlociCli.VersionProvider.class,
|
||||
subcommands = {
|
||||
StartCommand.class,
|
||||
StopCommand.class,
|
||||
RestartCommand.class,
|
||||
StatusCommand.class,
|
||||
LogsCommand.class,
|
||||
WaitCommand.class,
|
||||
VersionCommand.class,
|
||||
ServicesCommand.class,
|
||||
DoctorCommand.class,
|
||||
ConfigCommand.class,
|
||||
SnapshotCommand.class,
|
||||
CompletionCommand.class,
|
||||
HelpCommand.class
|
||||
}
|
||||
)
|
||||
public class FlociCli implements Runnable {
|
||||
|
||||
static class VersionProvider implements IVersionProvider {
|
||||
@Override
|
||||
public String[] getVersion() {
|
||||
return new String[]{"floci " + VersionCommand.CLI_VERSION};
|
||||
}
|
||||
}
|
||||
|
||||
static class ExceptionHandler implements IExecutionExceptionHandler {
|
||||
@Override
|
||||
public int handleExecutionException(Exception ex, CommandLine cmd, ParseResult parseResult) {
|
||||
System.err.println(Ansi.red("Error: ") + ex.getMessage());
|
||||
if (Boolean.getBoolean("floci.verbose")) {
|
||||
ex.printStackTrace(System.err);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Honor NO_COLOR and non-TTY environments
|
||||
if (System.getenv("NO_COLOR") != null || System.console() == null) {
|
||||
Ansi.disable();
|
||||
}
|
||||
int exitCode = new CommandLine(new FlociCli())
|
||||
.setExecutionExceptionHandler(new ExceptionHandler())
|
||||
.setCaseInsensitiveEnumValuesAllowed(true)
|
||||
.execute(args);
|
||||
System.exit(exitCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new CommandLine(this).usage(System.out);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user