mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-08-06 09:01:00 +08:00
fixed: 解决gocli目录问题导致错误
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'dart:io';
|
||||
import 'package:args/args.dart';
|
||||
import 'package:args/command_runner.dart';
|
||||
//import './version.dart';
|
||||
@ -20,11 +20,18 @@ class _CommandRunner extends CommandRunner<int> {
|
||||
addCommand(CreatePageCommand());
|
||||
addCommand(WatchCommand());
|
||||
addCommand(Build());
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Future<int> runCommand(ArgResults topLevelResults) async {
|
||||
bool isProject = await Directory('./go-cli').exists();
|
||||
// 防止用户在gocli下运行
|
||||
|
||||
if (!isProject) {
|
||||
print("请在fluttergo项目根目录中运行,而不是go-cli目录中");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (topLevelResults['version'] as bool) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ void createPage() async {
|
||||
// 创建root文件
|
||||
await createFile(demoPath);
|
||||
|
||||
pageMarkdown = await readeFile("${environmentVars['PWD']}/go-cli/utils/tpl.md");
|
||||
pageMarkdown = await readeFile("go-cli/utils/tpl.md");
|
||||
|
||||
writeContent2Path('$demoPath/', 'index.dart', """
|
||||
String getMd() {
|
||||
|
Reference in New Issue
Block a user