| 📦 Turbo MoonBit cc1f595 k33g 17h ago | 1 | # turbo-moonbit tools. |
| 2 | # |
| 3 | # Each [[tool]] becomes one line of the MoonBit menu, in the order they appear |
| 4 | # here. name is what the menu shows; a letter between tildes is its hot key, and |
| 5 | # no two tools should claim the same one. |
| 6 | # |
| 7 | # command goes to "sh -c", so pipes, globs and && work: one entry can be a |
| 8 | # whole sequence. |
| 9 | # |
| 10 | # menu says which menu it appears in. Leave it out and the tool goes into the |
| 11 | # MoonBit menu; name anything else and that menu is created for you, in the |
| 12 | # order the names first appear here. A tool that has nothing to do with MoonBit |
| 13 | # belongs in one of your own: |
| 14 | # |
| 15 | # [[tool]] |
| 16 | # name = "~E~cho" |
| 17 | # command = "echo TADA" |
| 18 | # menu = "Tools" |
| 19 | # |
| 20 | # A {{label}} in a command is a value the editor asks for before running it, in |
| 21 | # a box titled after the tool. The text between the braces is what it asks for: |
| 22 | # |
| 23 | # [[tool]] |
| 24 | # name = "~A~dd a dependency" |
| 25 | # command = "moon add {{module}}" |
| 26 | # |
| 27 | # The value is quoted, so a path with a space in it stays one argument. Add ... |
| 28 | # inside the braces when you mean several arguments rather than one value: |
| 29 | # |
| 30 | # [[tool]] |
| 31 | # name = "Test ~o~ne" |
| 32 | # command = "moon test {{extra flags...}}" |
| 33 | # |
| 34 | # Double braces, not single. Single ones appear in real commands — awk '{print |
| 35 | # $1}' and find . -exec rm {} + are both ordinary things to put here — and |
| 36 | # neither is asking you for anything. |
| 37 | # |
| 38 | # output says where what the command prints goes: |
| 39 | # popup a dialog that fills in as it runs, and says the exit code (default) |
| 40 | # terminal a terminal window, for anything that reads the keyboard or runs long |
| 41 | # editor an editing window once it has finished, to search with Ctrl-F |
| 42 | # |
| 43 | # Commands run in the directory the editor was started in, which is why they |
| 44 | # see the whole project when you start from its root. moon itself looks upwards |
| 45 | # for moon.mod, so most of these also work from a package inside the project. |
| 46 | |
| 47 | [[tool]] |
| 48 | name = "~C~heck" |
| 49 | # The fastest thing that tells you whether the project is sound: it type-checks |
| 50 | # without emitting object files, which is why it comes first rather than build. |
| 51 | command = "moon check" |
| 52 | output = "popup" |
| 53 | |
| 54 | [[tool]] |
| 55 | name = "~F~ormat" |
| 56 | command = "moon fmt" |
| 57 | output = "popup" |
| 58 | |
| 59 | [[tool]] |
| 60 | name = "~B~uild" |
| 61 | # MoonBit compiles to several backends, and which one a project wants is not |
| 62 | # something a starter file can know. The value is asked for rather than fixed: |
| 63 | # wasm, wasm-gc, js, native, llvm, or all. |
| 64 | command = "moon build --target {{backend: wasm-gc, js, native, llvm or all...}}" |
| 65 | output = "popup" |
| 66 | |
| 67 | [[tool]] |
| 68 | name = "~T~est" |
| 69 | command = "moon test" |
| 70 | output = "popup" |
| 71 | |
| 72 | [[tool]] |
| 73 | name = "~R~un" |
| 74 | command = "moon run {{package, e.g. cmd/main}}" |
| 75 | # A terminal, not a popup: a program that reads the keyboard has to be able to |
| 76 | # be answered, and one that runs long has to be able to be interrupted. |
| 77 | output = "terminal" |
| 78 | |
| 79 | [[tool]] |
| 80 | name = "~A~dd a dependency" |
| 81 | command = "moon add {{module, e.g. moonbitlang/x}}" |
| 82 | output = "popup" |
| 83 | |
| 84 | [[tool]] |
| 85 | name = "~I~nterfaces" |
| 86 | # Regenerates the .mbti files that record each package's public surface. Worth |
| 87 | # a menu entry because a diff in one is how a review sees that an API changed. |
| 88 | command = "moon info" |
| 89 | output = "popup" |
| 90 | |
| 91 | [[tool]] |
| 92 | name = "C~l~ean" |
| 93 | command = "moon clean" |
| 94 | output = "popup" |
| 95 | |
| 96 | # A tool naming a `menu` gets a menu of its own on the bar. Nothing above does, |
| 97 | # so every tool above is in the MoonBit menu. This one is in a menu called |
| 98 | # Tools, which appears between MoonBit and Help — that is the whole mechanism. |
| 99 | |
| 100 | [[tool]] |
| 101 | name = "~E~cho" |
| 102 | command = "echo 🎉 tada!" |
| 103 | menu = "Tools" |
| 104 | output = "terminal" |