Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions puro/lib/src/cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'commands/flutter.dart';
import 'commands/gc.dart';
import 'commands/internal_generate_ast_parser.dart';
import 'commands/internal_generate_docs.dart';
import 'commands/locate_sdk.dart';
import 'commands/ls_versions.dart';
import 'commands/prefs.dart';
import 'commands/pub.dart';
Expand Down Expand Up @@ -263,6 +264,7 @@ void main(List<String> args) async {
..addCommand(DartCommand())
..addCommand(PubCommand())
..addCommand(RunCommand())
..addCommand(LocateSdkCommand())
..addCommand(GenerateDocsCommand())
..addCommand(GenerateASTParserCommand())
..addCommand(PuroUpgradeCommand())
Expand Down
34 changes: 34 additions & 0 deletions puro/lib/src/commands/locate_sdk.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'dart:async';

import '../command.dart';
import '../command_result.dart';
import '../env/default.dart';
import '../terminal.dart';

class LocateSdkCommand extends PuroCommand {
@override
final name = 'sdk';

@override
// Command will be used by tools,
// so there's no way to react anyways
final allowUpdateCheck = false;

@override
final description = '''Prints the SDK path of the current environment.

This can be used to configure vscode://settings/dart.getFlutterSdkCommand
to automatically pick up the SDK of your puro environment.

See https://github.com/Dart-Code/Dart-Code/pull/5377''';

@override
Future<CommandResult>? run() async {
final environment = await getProjectEnvOrDefault(scope: scope);
final path = environment.flutter.sdkDir.absolute.path;
return BasicMessageResult(
path,
type: CompletionType.plain,
);
}
}