diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-04-09 10:24:42 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-04-09 10:24:42 +0800 |
| commit | b0f2a35eeb7c7b37c226b73fad51a0b8230daa62 (patch) | |
| tree | 363d1950c11ae417205fb44b6a9fab60d7c5c0af | |
| parent | ab3f56be961531d92027319b0f906bfd8c167e2e (diff) | |
| download | yuescript-b0f2a35eeb7c7b37c226b73fad51a0b8230daa62.tar.gz yuescript-b0f2a35eeb7c7b37c226b73fad51a0b8230daa62.tar.bz2 yuescript-b0f2a35eeb7c7b37c226b73fad51a0b8230daa62.zip | |
clean up.
Diffstat (limited to '')
| -rw-r--r-- | README.md | 9 | ||||
| -rw-r--r-- | src/moonp.cpp | 4 |
2 files changed, 10 insertions, 3 deletions
| @@ -67,7 +67,7 @@ Usage: moonp [options|files|directories] ... | |||
| 67 | -e str Execute a file or raw codes | 67 | -e str Execute a file or raw codes |
| 68 | -t path Specify where to place compiled files | 68 | -t path Specify where to place compiled files |
| 69 | -o file Write output to file | 69 | -o file Write output to file |
| 70 | -s Use space in generated codes instead of tabs | 70 | -s Use spaces in generated codes instead of tabs |
| 71 | -m Generate minified codes | 71 | -m Generate minified codes |
| 72 | -p Write output to standard out | 72 | -p Write output to standard out |
| 73 | -b Dump compile time (doesn't write output) | 73 | -b Dump compile time (doesn't write output) |
| @@ -79,6 +79,13 @@ Usage: moonp [options|files|directories] ... | |||
| 79 | Execute without options to enter REPL, type symbol '$' | 79 | Execute without options to enter REPL, type symbol '$' |
| 80 | in a single line to start/stop multi-line mode | 80 | in a single line to start/stop multi-line mode |
| 81 | ``` | 81 | ``` |
| 82 |   Use cases: | ||
| 83 |   Recursively compile every moon file under current path: `moonp .` | ||
| 84 |   Compile and save results to a target path: `moonp -t /target/path/ .` | ||
| 85 |   Compile and reserve debug info: `moonp -l .` | ||
| 86 |   Compile and generate minified codes: `moonp -m .` | ||
| 87 |   Execute raw codes: `moonp -e 'print 123'` | ||
| 88 |   Execute a moon file: `moonp -e main.moon` | ||
| 82 | 89 | ||
| 83 | 90 | ||
| 84 | 91 | ||
diff --git a/src/moonp.cpp b/src/moonp.cpp index 57c3d6d..e056aad 100644 --- a/src/moonp.cpp +++ b/src/moonp.cpp | |||
| @@ -94,7 +94,7 @@ int main(int narg, const char** args) { | |||
| 94 | " -e str Execute a file or raw codes\n" | 94 | " -e str Execute a file or raw codes\n" |
| 95 | " -t path Specify where to place compiled files\n" | 95 | " -t path Specify where to place compiled files\n" |
| 96 | " -o file Write output to file\n" | 96 | " -o file Write output to file\n" |
| 97 | " -s Use space in generated codes instead of tabs\n" | 97 | " -s Use spaces in generated codes instead of tabs\n" |
| 98 | " -m Generate minified codes\n" | 98 | " -m Generate minified codes\n" |
| 99 | " -p Write output to standard out\n" | 99 | " -p Write output to standard out\n" |
| 100 | " -b Dump compile time (doesn't write output)\n" | 100 | " -b Dump compile time (doesn't write output)\n" |
| @@ -501,7 +501,7 @@ int main(int narg, const char** args) { | |||
| 501 | std::ofstream output(file, std::ios::trunc | std::ios::out); | 501 | std::ofstream output(file, std::ios::trunc | std::ios::out); |
| 502 | output.write(minifiedCodes, size); | 502 | output.write(minifiedCodes, size); |
| 503 | output.close(); | 503 | output.close(); |
| 504 | std::cout << "Built Minified "sv << file << '\n'; | 504 | std::cout << "Minified built "sv << file << '\n'; |
| 505 | } | 505 | } |
| 506 | } else { | 506 | } else { |
| 507 | ret = 2; | 507 | ret = 2; |
