mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 06:15:44 +08:00
Add version output to CLI
This commit is contained in:
parent
58f8c24ddb
commit
0cd5edc287
@ -115,6 +115,7 @@ static bool reportModuleResult(Luau::Frontend& frontend, const Luau::ModuleName&
|
||||
|
||||
static void displayHelp(const char* argv0)
|
||||
{
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
printf("Usage: %s [--mode] [options] [file list]\n", argv0);
|
||||
printf("\n");
|
||||
printf("Available modes:\n");
|
||||
@ -304,6 +305,11 @@ int main(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc >= 2 && (strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version") == 0)) {
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ReportFormat format = ReportFormat::Default;
|
||||
Luau::Mode mode = Luau::Mode::Nonstrict;
|
||||
bool annotate = false;
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
static void displayHelp(const char* argv0)
|
||||
{
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
printf("Usage: %s [file]\n", argv0);
|
||||
}
|
||||
|
||||
@ -34,6 +35,11 @@ int main(int argc, char** argv)
|
||||
displayHelp(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
else if (argc >= 2 && (strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "--version") == 0))
|
||||
{
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
return 0;
|
||||
}
|
||||
else if (argc < 2)
|
||||
{
|
||||
displayHelp(argv[0]);
|
||||
|
@ -32,10 +32,12 @@ static Luau::CompileOptions copts()
|
||||
|
||||
static void displayHelp(const char* argv0)
|
||||
{
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
printf("Usage: %s [options] [file list]\n", argv0);
|
||||
printf("\n");
|
||||
printf("Available options:\n");
|
||||
printf(" -h, --help: Display this usage message.\n");
|
||||
printf(" -v, --version: Display Luau version.");
|
||||
printf(" -O<n>: compile with optimization level n (default 1, n should be between 0 and 2).\n");
|
||||
printf(" -g<n>: compile with debug level n (default 1, n should be between 0 and 2).\n");
|
||||
printf(" --fflags=<fflags>: flags to be enabled.\n");
|
||||
@ -52,6 +54,10 @@ static bool parseArgs(int argc, char** argv, std::string& summaryFile)
|
||||
{
|
||||
displayHelp(argv[0]);
|
||||
}
|
||||
else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
|
||||
{
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
}
|
||||
else if (strncmp(argv[i], "-O", 2) == 0)
|
||||
{
|
||||
int level = atoi(argv[i] + 2);
|
||||
|
@ -402,6 +402,7 @@ static bool compileFile(const char* name, CompileFormat format, Luau::CodeGen::A
|
||||
|
||||
static void displayHelp(const char* argv0)
|
||||
{
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
printf("Usage: %s [--mode] [options] [file list]\n", argv0);
|
||||
printf("\n");
|
||||
printf("Available modes:\n");
|
||||
@ -409,6 +410,7 @@ static void displayHelp(const char* argv0)
|
||||
printf("\n");
|
||||
printf("Available options:\n");
|
||||
printf(" -h, --help: Display this usage message.\n");
|
||||
printf(" -v, --version: Display version.\n");
|
||||
printf(" -O<n>: compile with optimization level n (default 1, n should be between 0 and 2).\n");
|
||||
printf(" -g<n>: compile with debug level n (default 1, n should be between 0 and 2).\n");
|
||||
printf(" --target=<target>: compile code for specific architecture (a64, x64, a64_nf, x64_ms).\n");
|
||||
@ -470,6 +472,11 @@ int main(int argc, char** argv)
|
||||
displayHelp(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
|
||||
{
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
return 0;
|
||||
}
|
||||
else if (strncmp(argv[i], "-O", 2) == 0)
|
||||
{
|
||||
int level = atoi(argv[i] + 2);
|
||||
|
@ -470,6 +470,7 @@ struct Reducer
|
||||
|
||||
[[noreturn]] void help(const std::vector<std::string_view>& args)
|
||||
{
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
printf("Syntax: %s script command \"search text\"\n", args[0].data());
|
||||
printf(" Within command, use {} as a stand-in for the script being reduced\n");
|
||||
exit(1);
|
||||
@ -482,6 +483,9 @@ int main(int argc, char** argv)
|
||||
if (args.size() != 4)
|
||||
help(args);
|
||||
|
||||
if (args[1] == "-v" || args[1] == "--version")
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
|
||||
for (size_t i = 1; i < args.size(); ++i)
|
||||
{
|
||||
if (args[i] == "--help")
|
||||
|
@ -656,6 +656,7 @@ static bool runFile(const char* name, lua_State* GL, bool repl)
|
||||
|
||||
static void displayHelp(const char* argv0)
|
||||
{
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
printf("Usage: %s [options] [file list] [-a] [arg list]\n", argv0);
|
||||
printf("\n");
|
||||
printf("When file list is omitted, an interactive REPL is started instead.\n");
|
||||
@ -664,6 +665,7 @@ static void displayHelp(const char* argv0)
|
||||
printf(" --coverage: collect code coverage while running the code and output results to coverage.out\n");
|
||||
printf(" -h, --help: Display this usage message.\n");
|
||||
printf(" -i, --interactive: Run an interactive REPL after executing the last script specified.\n");
|
||||
printf(" -v, --version: Display version.\n");
|
||||
printf(" -O<n>: compile with optimization level n (default 1, n should be between 0 and 2).\n");
|
||||
printf(" -g<n>: compile with debug level n (default 1, n should be between 0 and 2).\n");
|
||||
printf(" --profile[=N]: profile the code using N Hz sampling (default 10000) and output results to profile.out\n");
|
||||
@ -705,6 +707,11 @@ int replMain(int argc, char** argv)
|
||||
{
|
||||
interactive = true;
|
||||
}
|
||||
else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
|
||||
{
|
||||
printf("%s\n", LUAU_VERSION);
|
||||
return 0;
|
||||
}
|
||||
else if (strncmp(argv[i], "-O", 2) == 0)
|
||||
{
|
||||
int level = atoi(argv[i] + 2);
|
||||
|
@ -1,6 +1,8 @@
|
||||
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
||||
#pragma once
|
||||
|
||||
#define LUAU_VERSION "Luau 0.636"
|
||||
|
||||
// Compiler codegen control macros
|
||||
#ifdef _MSC_VER
|
||||
#define LUAU_NORETURN __declspec(noreturn)
|
||||
|
Loading…
Reference in New Issue
Block a user