processWhile method

Future processWhile({
  1. @Deprecated('Use appLabel instead') String promptLabel = 'App> ',
  2. String appLabel()?,
  3. List<String>? initArgs,
})

Implementation

Future processWhile({
  @Deprecated('Use appLabel instead') String promptLabel = 'App> ',

  /// [appLabel] is a function that returns the label of the prompt.
  /// It will be called before each prompt.
  /// You can use it to show dynamic labels.
  String Function()? appLabel,
  List<String>? initArgs,
}) async {
  if (appLabel == null) {
    appLabel = () => promptLabel;
  } else {
    promptLabel = appLabel();
  }
  if (initArgs != null && initArgs.isNotEmpty) {
    args = initArgs;
    await process();
  }

  if (onKeyPress != null) {
    await _processWhileRaw(appLabel);
  } else {
    await _processWhileLine(appLabel);
  }
}