diff --git a/bin/scip_dart.dart b/bin/scip_dart.dart index fa354392..ff375553 100644 --- a/bin/scip_dart.dart +++ b/bin/scip_dart.dart @@ -6,6 +6,7 @@ import 'package:package_config/package_config.dart'; import 'package:pubspec_parse/pubspec_parse.dart'; import 'package:path/path.dart' as p; import 'package:scip_dart/src/flags.dart'; +import 'package:scip_dart/src/version.dart'; Future main(List args) async { final result = (ArgParser() @@ -21,6 +22,8 @@ Future main(List args) async { defaultsTo: false, help: 'Whether or not to display debugging text during indexing', ) + ..addFlag('version', + defaultsTo: false, help: 'Display the current version of scip-dart') ..addMultiOption( 'path', abbr: 'p', @@ -28,6 +31,11 @@ Future main(List args) async { )) .parse(args); + if (result['version'] as bool) { + print(scipDartVersion); + exit(0); + } + Flags.instance.init(result); if ((result['path'] as List?)?.isNotEmpty == true) { diff --git a/lib/src/indexer.dart b/lib/src/indexer.dart index ddf6cac6..d5c58732 100644 --- a/lib/src/indexer.dart +++ b/lib/src/indexer.dart @@ -10,6 +10,7 @@ import 'package:scip_dart/src/flags.dart'; import 'package:scip_dart/src/gen/scip.pb.dart'; import 'package:scip_dart/src/scip_visitor.dart'; import 'package:scip_dart/src/utils.dart'; +import 'package:scip_dart/src/version.dart'; Future indexPackage( String root, @@ -34,7 +35,7 @@ Future indexPackage( textDocumentEncoding: TextEncoding.UTF8, toolInfo: ToolInfo( name: 'scip-dart', - version: '0.0.1', + version: scipDartVersion, arguments: [], ), ); diff --git a/lib/src/version.dart b/lib/src/version.dart new file mode 100644 index 00000000..ecd0b8d3 --- /dev/null +++ b/lib/src/version.dart @@ -0,0 +1,5 @@ +// This should be kept in sync with the version for scip-dart that is +// stored within pubspec.yaml + +/// The current version of scip_dart +const scipDartVersion = '1.1.1';