Appearance
| 1 | namespace Driver is | |
| 2 | // The `--help` text. Kept beside the argument loop in `main.ghul`, which is | |
| 3 | // the authority on what the compiler accepts: a flag added there wants a | |
| 4 | // line here too. | |
| 5 | class USAGE is | |
| 6 | is_requested(arguments: Collections.Iterable[string]) -> bool static is | |
| 7 | for argument in arguments do | |
| 8 | if argument =~ "-h" \/ argument =~ "--help" \/ argument =~ "-?" then | |
| 9 | return true | |
| 10 | fi | |
| 11 | od | |
| 12 | ||
| 13 | return false | |
| 14 | si | |
| 15 | ||
| 16 | // In two halves: the formatter joins adjacent literals into one, and | |
| 17 | // a single literal of this length does not parse back after a comment | |
| 18 | text: string static => "{_head}{_tail}" | |
| 19 | ||
| 20 | _head: string static => | |
| 21 | "usage: ghul-compiler [options] <source.ghul> ...\n" | |
| 22 | "\n" | |
| 23 | "Compiles ghūl source files to a .NET assembly. With no -a or --sdk-ref-path,\n" | |
| 24 | "the .NET reference assemblies are discovered from the installed SDK, so a\n" | |
| 25 | "source file on its own is a complete command line:\n" | |
| 26 | "\n" | |
| 27 | " ghul-compiler hello.ghul\n" | |
| 28 | "\n" | |
| 29 | "The output is named after the first source file unless -o says otherwise. A\n" | |
| 30 | "program that uses the ghūl runtime needs ghul-runtime.dll beside the binary\n" | |
| 31 | "before it will run; an MSBuild build puts it there for you.\n" | |
| 32 | "\n" | |
| 33 | "modes:\n" | |
| 34 | " -A, --analyse serve language-service requests on stdin/stdout\n" | |
| 35 | " --compile-server compile one JSON request per line from stdin, replying on stdout\n" | |
| 36 | " -G, --type-check parse and type-check only, emitting nothing\n" | |
| 37 | " -g, --no-type-check parse only\n" | |
| 38 | " --check-complete parse one source and print complete, incomplete or invalid\n" | |
| 39 | " -S, --assembler generate code but write no assembly\n" | |
| 40 | " --format reformat the sources to standard output\n" | |
| 41 | " --format-in-place reformat the source files themselves\n" | |
| 42 | " --format-width <cols> column the formatter wraps at (default 100)\n" | |
| 43 | " --library build a library rather than an executable\n" | |
| 44 | "\n" | |
| 45 | "output:\n" | |
| 46 | " -o, --output <path> write the assembly here\n" | |
| 47 | " --debug emit debug information; an llvm build is unoptimised unless --optimise is given\n" | |
| 48 | " --optimise <0-3> the llvm target's optimisation level; 2 by default\n" | |
| 49 | " --target-framework <tfm> target framework moniker, e.g. net10.0\n" | |
| 50 | " --version <version> version stamped into the assembly\n" | |
| 51 | " --resource <path>=<name> embed <path> as a managed resource named <name>; repeatable\n" | |
| 52 | " --assembly-info-string <attribute>=<value>\n" | |
| 53 | " apply this attribute to the assembly; a value with a comma\n" | |
| 54 | " fills a two-string constructor when there is no one-string one\n" | |
| 55 | "\n" | |
| 56 | "references:\n" | |
| 57 | " -a, --assembly <name> reference this assembly; repeatable, and naming any replaces the default set\n" | |
| 58 | " --reference <name> reference this assembly as well as the reference set; repeatable\n" | |
| 59 | " --sdk-ref-path <dir> directory holding the .NET reference assemblies\n" | |
| 60 | " -p, --library-prefix <path> prefix for resolving referenced assemblies\n" | |
| 61 | " --exclude-runtime-symbols do not load the ghūl runtime's symbols\n" | |
| 62 | "\n" | |
| 63 | ||
| 64 | _tail: string static => | |
| 65 | "compilation:\n" | |
| 66 | " --default-use <names> what `use default` imports; comma-separated\n" | |
| 67 | " --define <symbol> define a conditional compilation symbol\n" | |
| 68 | " --entry <name> name of the entry point function\n" | |
| 69 | " --global-namespace share one namespace across namespace-less files\n" | |
| 70 | " --cells each namespace-less file is a cell of one session: its namespace is its file name, its entry returns its final expression's value, and it is not the entry point\n" | |
| 71 | " --implicit-default-use give each namespace-less file an implicit `use default`\n" | |
| 72 | " --library-source <name>@<version>=<root>\n" | |
| 73 | " declare a source library rooted at <root>; its files belong to that library; repeatable\n" | |
| 74 | " --library-warnings report warnings, infos and hints in source library files, which are left out otherwise\n" | |
| 75 | " --submission <name> compile one step of an interactive session: the namespace-less file's namespace is <name>, and its entry returns its final expression's value\n" | |
| 76 | " --session cells as --cells builds them, plus the semantics retained code needs: the narrow guards, the exhaustive-case throw, and open-world dispatch for classes a later cell can extend\n" | |
| 77 | " --target <name> compile for dotnet, wasm or llvm\n" | |
| 78 | " --underscore-access <m> underscore visibility: private, protected, legacy\n" | |
| 79 | " --wat <path> also write the wasm module's text form to <path>\n" | |
| 80 | " --wat-lines in that text, a ';; file:line' comment before each statement, and locals named\n" | |
| 81 | " --wat-program-only in that text, only the functions compiled from the program's own sources\n" | |
| 82 | " --llvm-output <path> also write the llvm module's text form to <path>\n" | |
| 83 | " --llvm-program-only in that text, only the functions compiled from the program's own sources\n" | |
| 84 | " --llvm-no-link with --llvm-output, write that text and link nothing\n" | |
| 85 | " -E, --ignore-errors carry on emitting after an error\n" | |
| 86 | "\n" | |
| 87 | "diagnostics:\n" | |
| 88 | " --suppress <slugs> silence these warnings; comma-separated\n" | |
| 89 | " --warn-as-error <slugs> promote these warnings to errors, or all\n" | |
| 90 | " --warn-as-info <slugs> demote these warnings to information\n" | |
| 91 | " --warn-as-hint <slugs> demote these warnings to editor hints\n" | |
| 92 | " --msbuild-diagnostics report diagnostics in MSBuild's format\n" | |
| 93 | "\n" | |
| 94 | "analysis mode:\n" | |
| 95 | " --incremental-analysis reuse the symbol table across edits\n" | |
| 96 | " --analysis-idle-timeout <seconds> exit after this long without a request\n" | |
| 97 | " --show-analysis-stats report timings for each analysis request\n" | |
| 98 | " --no-analysis-heap-watchdog do not force collection when the heap grows\n" | |
| 99 | "\n" | |
| 100 | "other:\n" | |
| 101 | " -h, -?, --help show this message\n" | |
| 102 | " --requirements print the oldest ghul-core, ghul-runtime and ghul-llvm releases\n" | |
| 103 | " this compiler works with, as JSON, and exit\n" | |
| 104 | " @<file> read further arguments from this file\n" | |
| 105 | "\n" | |
| 106 | "With no arguments at all the compiler prints its version. There is no flag\n" | |
| 107 | "for that: --version sets the version of the assembly being built.\n" | |
| 108 | si | |
| 109 | si |