run method

  1. @override
Future<void> run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
Future<void> run() async {
  final currentDirectory = Directory.current;
  final depth = int.tryParse(argResults!['depth'] as String) ?? -1;
  final includeAll = argResults!['all'] as bool;

  List<Glob>? ignoreGlobs;
  if (!includeAll) {
    ignoreGlobs = await _loadGitignore(currentDirectory);
  }

  await _printFileTree(currentDirectory, depth: depth, ignoreGlobs: ignoreGlobs);
}