selfCommand static method

List<String> selfCommand()

The command that re-runs this CLI: the compiled executable itself, or the Dart VM with this script/snapshot (pub global activate, dart run).

Implementation

static List<String> selfCommand() {
  final exe = Platform.resolvedExecutable;
  final script = Platform.script.toFilePath();
  const scriptExtensions = ['.dart', '.snapshot', '.dill', '.jit'];
  if (scriptExtensions.any(script.endsWith)) {
    return [exe, ...Platform.executableArguments, script];
  }
  return [exe];
}