cli/args_helpers library

Functions

fmtBytes(int bytes) → String
Formats bytes as a human-readable string with one decimal place.
isRefArg(String arg) → bool
True for an argument that looks like an fdb describe ref (@...).
parsePointList(String raw) → List<(double, double)>?
Parses a semicolon-separated list of "x,y" coordinate pairs into a list of (double, double) tuples, or returns null if malformed or fewer than 2 points are present.
parseRefArg(String arg) → int?
Parses an fdb describe ref (@N, N >= 1) into N.
parseXY(String raw) → (double, double)?
Parses an "x,y" coordinate string into a (double, double) tuple, or returns null if the input is malformed.
readTimeoutSecondsOption(ArgResults results, {required int defaultSeconds}) → int?
Reads the --timeout option as a positive whole number of seconds, falling back to defaultSeconds when the flag is absent.
rejectRefWithOtherTarget({required int? ref, required bool hasOtherTarget}) → bool
Writes an error and returns true when a ref is combined with another target (a selector or coordinates).
runCliAdapter(ArgParser parser, List<String> args, Future<int> execute(ArgResults)) → Future<int>
Runs a CLI adapter end-to-end:
runSimpleCliAdapter(List<String> args, Future<int> execute(List<String>), {String helpText = 'No options for this command.'}) → Future<int>
Runs a CLI adapter that accepts no options. Skips ArgParser construction entirely; just intercepts --help/-h and otherwise calls execute with the raw args (allowing the executor to inspect positional arguments).