globbing 0.0.2 copy "globbing: ^0.0.2" to clipboard
globbing: ^0.0.2 copied to clipboard

discontinued
outdatedDart 1 only

Globbing is a library for the pattern matching based on wildcard characters. Includes helper for a list of files.

globbing #

Globbing is a library for the pattern matching based on wildcard characters. Includes helper for a list of files.

BETA VERSION

import "dart:io";
import "package:globbing/file_list.dart";

void main() {
  // Find "unittest" packages in "pub cache"
  var pubCache = getPubCachePath();
  if (pubCache != null) {
    var mask = "**/unittest*/pubspec.yaml";
    var files = new FileList(new Directory(pubCache), mask);
    if (!files.isEmpty) {
      var list = files.toList();
      var length = list.length;
      print("Found $length version(s) of unittest");
      for (var file in files) {
        print(file);
      }
    }
  }

  // Find CHANGELOG's in "pub cache"
  if (pubCache != null) {
    var mask = "**/CHANGELOG*";
    var files = new FileList(new Directory(pubCache), mask);
    if (!files.isEmpty) {
      var list = files.toList();
      var length = list.length;
      print("Found $length 'CHANGELOG' files");
      for (var file in files) {
        print(file);
      }
    }
  }

  // Find packages with major version (approximately)
  if (pubCache != null) {
    var mask = "**/*[1-9]*.[0-9]*.[0-9]*/pubspec.yaml";
    var files = new FileList(new Directory(pubCache), mask);
    if (!files.isEmpty) {
      var list = files.toList();
      var length = list.length;
      print("Found $length packages with major version");
      for (var file in files) {
        print(file);
      }
    }
  }
}

String getPubCachePath() {
  var result = Platform.environment["PUB_CACHE"];
  if (result != null) {
    return result;
  }

  if (Platform.isWindows) {
    var appData = Platform.environment["APPDATA"];
    if (appData != null) {
      result = "$appData/Pub/Cache";
    }
  } else {
    var home = Platform.environment["HOME"];
    result = "$home/.pub-cache";
  }

  if (result != null) {
    var dir = new Directory(result);
    if (dir.existsSync()) {
      return dir.path;
    }
  }

  return null;
}
2
likes
0
pub points
88%
popularity

Publisher

unverified uploader

Globbing is a library for the pattern matching based on wildcard characters. Includes helper for a list of files.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

ascii, lists

More

Packages that depend on globbing