mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-22 21:50:47 -05:00
fix(profile): make profile names, files and exit codes consistent (#33)
This commit is contained in:
1 parent
bf9ee4037b
commit
5c0cc339bf
9 files changed
+263
-44
No files matched your search
@@ -2,6 +2,7 @@ package io.floci.cli.commands;
|
||||
|
||||
import io.floci.cli.GlobalOptions;
|
||||
import io.floci.cli.ProductProfile;
|
||||
import io.floci.cli.config.ProfileNotFoundException;
|
||||
import io.floci.cli.config.ProfileStore;
|
||||
import io.floci.cli.output.Printer;
|
||||
import picocli.CommandLine.*;
|
||||
@@ -44,7 +45,15 @@ public class RestartCommand implements Callable<Integer> {
|
||||
// Resolve the profile BEFORE stopping anything. A failure here must not leave the
|
||||
// container stopped, and the values must not be re-read from a file that could change
|
||||
// during the stop plus the one second wait below.
|
||||
StartCommand start = buildStartCommand();
|
||||
StartCommand start;
|
||||
try {
|
||||
start = buildStartCommand();
|
||||
} catch (ProfileNotFoundException e) {
|
||||
// Gone or broken since the parse resolved it: nothing has been stopped yet, and the
|
||||
// exit code matches a bad --profile at parse time.
|
||||
printer.error(e.getMessage());
|
||||
return ExitCode.USAGE;
|
||||
}
|
||||
String invalid = start.validationError();
|
||||
if (invalid != null) {
|
||||
printer.error(invalid);
|
||||
|
||||
Reference in new issue
Block a user