mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-22 21:50:47 -05:00
fix(cli): keep wait's spinner out of -o json, reject bad durations and make --verbose work (#48)
* 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.
This commit is contained in:
1 parent
7ecc895baa
commit
52ebdee98d
8 files changed
+230
-10
No files matched your search
@@ -68,7 +68,7 @@ public class FlociCli implements Runnable {
|
||||
@Override
|
||||
public int handleExecutionException(Exception ex, CommandLine cmd, ParseResult parseResult) {
|
||||
System.err.println(Ansi.red("Error: ") + ex.getMessage());
|
||||
if (Boolean.getBoolean("floci.verbose")) {
|
||||
if (Boolean.getBoolean(GlobalOptions.VERBOSE_PROPERTY)) {
|
||||
ex.printStackTrace(System.err);
|
||||
}
|
||||
return 1;
|
||||
|
||||
Reference in new issue
Block a user