Skip to content

Commit

Permalink
Usage info
Browse files Browse the repository at this point in the history
  • Loading branch information
Seggan committed Oct 21, 2023
1 parent 50d9317 commit c7a8916
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ dependencies {

application {
mainClass.set("io.github.seggan.metis.app.MainKt")
}

tasks.shadowJar {
archiveFileName.set("metis.jar")
}
5 changes: 4 additions & 1 deletion app/src/main/kotlin/io/github/seggan/metis/app/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ private object Main : CliktCommand(name = "metis") {
option("-f", "--file", help = "The file to run").path(mustExist = true, canBeDir = false).convert {
System.setProperty("user.dir", it.parent.absolutePathString())
CodeSource.fromPath(it)
}
},
option("-i", "--stdin", help = "Read code from stdin").flag(default = false).convert {
CodeSource.constant("<stdin>", generateSequence(::readlnOrNull).joinToString("\n"))
},
).single().required()
val debug by option("-d", "--debug", help = "Enable debug mode").flag(default = false)
val printChunk by option("-p", "--print-chunk", help = "Print the chunk").flag(default = false)
Expand Down
2 changes: 1 addition & 1 deletion docs/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def highlight(match):
group = match.group(1)
proc = subprocess.Popen(
["java", "-jar", "../app/build/libs/app-all.jar", "--syntax-highlight", "-c", group],
["java", "-jar", "../app/build/libs/metis.jar", "--syntax-highlight", "-c", group],
stdout=subprocess.PIPE
)
return proc.communicate()[0].decode("utf-8")
Expand Down
27 changes: 26 additions & 1 deletion docs/index.papyri
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,32 @@ Check out @href(`/lang`) { the language overview } to learn more about Metis, or
@href(`/lang/examples.html`) { examples } to see what Metis can do. If you want to embed Metis in your project,
check out the @href(`/javadocs`) { API documentation }.

@h2 { Credits }
@h2 Usage

The latest Metis release can be downloaded from @href(`htttps://github.com/Seggan/Metis/releases`) Github.
The release is JAR file that can be run with `java -jar metis.jar`. This requires at least Java 17 to be installed.

Here are all the command line arguments that Metis supports:

@table [
[{ @code `-i`, @code `--stdin`: }, `Read the code from STDIN`],
[{ @code `-f <file>`, @code `--file <file>`: }, `Read the code from a file`],
[{ @code `-c <code>`, @code `--code <code>`: }, `Read the code from the arguments`],
[{ @code `-d`, @code `--debug`: }, `Enable debug mode`],
[{ @code `-p`, @code `--print-chunk`: }, `Print a disassembly of the code to be run`],
[{ @code `-s`, @code `--syntax-highlight`: }, `Convert the code into syntax-highlighted HTML`],
]

@h2 Building

Metis is written in Kotlin, and uses Gradle as its build system. To build Metis, you need to have
Gradle installed. To build Metis, run the following command in the root directory:

@shell `./gradlew shadowJar`

This will create a JAR file in `app/build/libs` that can be run with `java -jar metis.jar`.

@h2 Credits

Metis is made by @href(`https://github.com/Seggan`) Seggan.

Expand Down
15 changes: 4 additions & 11 deletions docs/metis.lib.papyri
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,11 @@ nav_root_links=[
@code_block(language=.) $v
}

@fn tbl_row $row: inline list -> @match $row {
[$a, *$tail] -> { <td>$a</> @tbl_row $tail },
[] -> {},
}

@fn tbl_rows $rows: inline list list -> @match $rows {
[$a, *$tail] -> { <tr> @tbl_row $a </tr> @tbl_rows $tail },
[] -> {},
}

@export @fn table $tbl: inline list list -> { <table> @tbl_rows $tbl </> }
@fn tbl_row $row: inline list ->
<tr>@list::join @list::map(@fn $cell -> <td>$cell</>) $row</>

@export @fn table $tbl: inline list list ->
<table>@list::join @list::map($tbl_row) $tbl</>


@fn get_headings $content: html -> @match $content {
Expand Down

0 comments on commit c7a8916

Please sign in to comment.