Clone this repo:
  1. 8726cd3 Flip the strong-mode bit for `cli_utl`. by pq · 3 months ago master
  2. 3690f6e Merge pull request #9 from ochafik/getSdkDir_without_args by Phil Quitslund · 1 year, 2 months ago
  3. 1ad3a07 Test that getSdkDir() finds the SDK without CLI args. by Olivier Chafik · 1 year, 2 months ago
  4. 1bcc7a0 Support an executable in a symlinked directory. by Natalie Weizenbaum · 1 year, 2 months ago 0.0.1+2
  5. d180f7a Merge pull request #7 from dart-lang/sudo_fix by Phil Quitslund · 1 year, 3 months ago

cli_util

A library to help in building Dart command-line apps.

In particular, cli_util provides a simple, standardized way to get the current SDK directory. Useful, especially, when building client applications that interact with the Dart SDK (such as the analyzer).

Build Status

Usage

import 'dart:io';

import 'package:cli_util/cli_util.dart';
import 'package:path/path.dart' as path;

main(args) {
  // Get sdk dir from cli_util
  Directory sdkDir = getSdkDir(args);
  
  // Do stuff... For example, print version string
  File versionFile = new File(path.join(sdkDir.path, 'version'));
  print(versionFile.readAsStringSync());
}

Features and bugs

Please file feature requests and bugs at the issue tracker.