choosePath static method

String choosePath()

Implementation

static String choosePath() {
  final logger = Logger();
  final currentPath = Directory.current.path;

  final result = logger.chooseOne(
      Constants.kNeedSpecifyPath,
      choices: <String?>[
        Constants.kYes,
        Constants.kNo
      ],
      defaultValue: Constants.kNo
  );

  if (result == Constants.kYes) {
    return InputService.getValidatedInput(
        consoleMessage: Constants.kEnterPath,
        errorMessage: Constants.kInvalidPath,
        functionValidator: Validator.isValidPath
    ) ?? currentPath;
  }

  return currentPath;
}