readToolManualPath method

Future<String> readToolManualPath({
  1. required String toolName,
  2. String? examplePath,
  3. String? description,
})

Implementation

Future<String> readToolManualPath({
  required String toolName,
  String? examplePath,
  String? description,
}) async {
  logger.info(
    description ??
        '''You can use which command to find it in your remote machine: "which $toolName"
*NOTE: if you added $toolName to one of directories in \$PATH variables, you can just enter "$toolName" here.
${examplePath == null ? '' : '(example: $examplePath)'}''',
  );

  final manualEnteredPath = inputWithValidation(
    '$toolName path on device:',
    validator: (s) {
      if (s.isValidPath) {
        return null;
      }
      return 'Invalid Path to $toolName. Please try again.';
    },
  );

  /// check if [manualEnteredPath] is a valid file path
  if (!manualEnteredPath.isValidPath) {
    throwToolExit(
        'Invalid Path to $toolName. Please make sure about $toolName path on the remote machine and try again.');
  }

  return manualEnteredPath;
}