aboutsummaryrefslogtreecommitdiff
path: root/src/yue.cpp
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-11-16 10:53:09 +0800
committerLi Jin <dragon-fly@qq.com>2022-11-16 10:53:09 +0800
commitcfe8c31260fe2fabba1a3ce77adb6a85fc1fae47 (patch)
tree1ed31c2958a59ce1c33efda14119e0a7997d47f6 /src/yue.cpp
parent7ecfd8f02bad9ebba7e32894da278a48ef9ecee9 (diff)
downloadyuescript-cfe8c31260fe2fabba1a3ce77adb6a85fc1fae47.tar.gz
yuescript-cfe8c31260fe2fabba1a3ce77adb6a85fc1fae47.tar.bz2
yuescript-cfe8c31260fe2fabba1a3ce77adb6a85fc1fae47.zip
fix build. update doc.
Diffstat (limited to 'src/yue.cpp')
-rw-r--r--src/yue.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/yue.cpp b/src/yue.cpp
index 49fa3e1..4f5be8d 100644
--- a/src/yue.cpp
+++ b/src/yue.cpp
@@ -196,7 +196,7 @@ static std::string compileFile(const fs::path& srcFile, yue::YueConfig conf, con
196 196
197class UpdateListener : public efsw::FileWatchListener { 197class UpdateListener : public efsw::FileWatchListener {
198public: 198public:
199 void handleFileAction(efsw::WatchID, const std::string& dir, const std::string& filename, efsw::Action action, std::string oldFilename) override { 199 void handleFileAction(efsw::WatchID, const std::string& dir, const std::string& filename, efsw::Action action, std::string) override {
200 switch(action) { 200 switch(action) {
201 case efsw::Actions::Add: 201 case efsw::Actions::Add:
202 if (auto res = compileFile(fs::path(dir) / filename, config, workPath); !res.empty()) { 202 if (auto res = compileFile(fs::path(dir) / filename, config, workPath); !res.empty()) {
@@ -246,6 +246,7 @@ int main(int narg, const char** args) {
246 " -b Dump compile time (doesn't write output)\n" 246 " -b Dump compile time (doesn't write output)\n"
247 " -g Dump global variables used in NAME LINE COLUMN\n" 247 " -g Dump global variables used in NAME LINE COLUMN\n"
248 " -l Write line numbers from source codes\n" 248 " -l Write line numbers from source codes\n"
249 " -w path Watch changes and compile every file under directory\n"
249 " -v Print version\n" 250 " -v Print version\n"
250#ifndef YUE_COMPILER_ONLY 251#ifndef YUE_COMPILER_ONLY
251 " -- Read from standard in, print to standard out\n" 252 " -- Read from standard in, print to standard out\n"
@@ -581,14 +582,18 @@ int main(int narg, const char** args) {
581 } 582 }
582 } 583 }
583 if (!watchFiles && files.empty()) { 584 if (!watchFiles && files.empty()) {
584 std::cout << help; 585 std::cout << "no input files\n"sv;
585 return 0; 586 return 0;
586 } 587 }
587 if (!resultFile.empty() && files.size() > 1) { 588 if (!resultFile.empty() && files.size() > 1) {
588 std::cout << "Error: -o can not be used with multiple input files\n"sv; 589 std::cout << "Error: -o can not be used with multiple input files\n"sv;
589 std::cout << help; 590 return 1;
590 } 591 }
591 if (watchFiles) { 592 if (watchFiles) {
593 if (!targetPath.empty()) {
594 std::cout << "Error: -t can not be used with watching mode\n"sv;
595 return 1;
596 }
592 auto fullWorkPath = fs::absolute(fs::path(workPath)).string(); 597 auto fullWorkPath = fs::absolute(fs::path(workPath)).string();
593 std::list<std::future<std::string>> results; 598 std::list<std::future<std::string>> results;
594 for (const auto& file : files) { 599 for (const auto& file : files) {