isGloballyActivatedFromSource method
Returns true if the the dart project packageName
is running from local source.
This means that the package has been activated via
dart pub global activate --source path <path to package>
Implementation
bool isGloballyActivatedFromSource(String packageName) {
/// run pub global list to see if dcli is run from a local path.
final lines = DartSdk()
.runPub(args: ['global', 'list'], progress: Progress.capture()).lines;
final line = lines.firstWhere((line) => line.startsWith(packageName),
orElse: () => packageName);
return line.contains('at path');
}