Skip to content

Commit

Permalink
Version Command Added
Browse files Browse the repository at this point in the history
  • Loading branch information
samyakkkk committed Mar 28, 2024
1 parent 77fa3e6 commit 25dacfc
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
3 changes: 2 additions & 1 deletion commanddash/bin/commanddash.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:commanddash/runner.dart';

void main(List<String> arguments) async {
var runner = CommandRunner("commanddash", "CLI enhancements for Dash AI")
..addCommand(ProcessCommand());
..addCommand(ProcessCommand())
..addCommand(VersionCommand());
await runner.run(arguments);
}
Binary file removed commanddash/hey
Binary file not shown.
24 changes: 24 additions & 0 deletions commanddash/lib/runner.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import 'package:args/command_runner.dart';
import 'package:commanddash/server/server.dart';
import 'package:commanddash/server/task_handler.dart';
import 'dart:io';

import 'package:yaml/yaml.dart';

class ProcessCommand extends Command {
bool dryrun = false;
Expand All @@ -20,3 +23,24 @@ class ProcessCommand extends Command {
handler.initProcessing();
}
}

class VersionCommand extends Command {
@override
final String name = "version";

@override
final String description = "Print the current version of the CLI.";

VersionCommand();

@override
void run() {
final directory = Directory.current;

final file = File('${directory.path}/pubspec.yaml');
final pubspec = loadYaml(file.readAsStringSync());

final version = pubspec['version'];
print(version);
}
}
3 changes: 2 additions & 1 deletion commanddash/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ executables:

# Add regular dependencies here.
dependencies:
analyzer: ^6.4.1
analyzer: ^6.0.0
args: ^2.4.2
async: ^2.11.0
cli_util: ^0.4.1
rxdart: ^0.27.7
yaml: ^3.1.2
# path: ^1.8.0

dev_dependencies:
Expand Down

0 comments on commit 25dacfc

Please sign in to comment.