# turbo-moonbit tools. # # Each [[tool]] becomes one line of the MoonBit menu, in the order they appear # here. name is what the menu shows; a letter between tildes is its hot key, and # no two tools should claim the same one. # # command goes to "sh -c", so pipes, globs and && work: one entry can be a # whole sequence. # # menu says which menu it appears in. Leave it out and the tool goes into the # MoonBit menu; name anything else and that menu is created for you, in the # order the names first appear here. A tool that has nothing to do with MoonBit # belongs in one of your own: # # [[tool]] # name = "~E~cho" # command = "echo TADA" # menu = "Tools" # # A {{label}} in a command is a value the editor asks for before running it, in # a box titled after the tool. The text between the braces is what it asks for: # # [[tool]] # name = "~A~dd a dependency" # command = "moon add {{module}}" # # The value is quoted, so a path with a space in it stays one argument. Add ... # inside the braces when you mean several arguments rather than one value: # # [[tool]] # name = "Test ~o~ne" # command = "moon test {{extra flags...}}" # # Double braces, not single. Single ones appear in real commands — awk '{print # $1}' and find . -exec rm {} + are both ordinary things to put here — and # neither is asking you for anything. # # output says where what the command prints goes: # popup a dialog that fills in as it runs, and says the exit code (default) # terminal a terminal window, for anything that reads the keyboard or runs long # editor an editing window once it has finished, to search with Ctrl-F # # Commands run in the directory the editor was started in, which is why they # see the whole project when you start from its root. moon itself looks upwards # for moon.mod, so most of these also work from a package inside the project. [[tool]] name = "~C~heck" # The fastest thing that tells you whether the project is sound: it type-checks # without emitting object files, which is why it comes first rather than build. command = "moon check" output = "popup" [[tool]] name = "~F~ormat" command = "moon fmt" output = "popup" [[tool]] name = "~B~uild" # MoonBit compiles to several backends, and which one a project wants is not # something a starter file can know. The value is asked for rather than fixed: # wasm, wasm-gc, js, native, llvm, or all. command = "moon build --target {{backend: wasm-gc, js, native, llvm or all...}}" output = "popup" [[tool]] name = "~T~est" command = "moon test" output = "popup" [[tool]] name = "~R~un" command = "moon run {{package, e.g. cmd/main}}" # A terminal, not a popup: a program that reads the keyboard has to be able to # be answered, and one that runs long has to be able to be interrupted. output = "terminal" [[tool]] name = "~A~dd a dependency" command = "moon add {{module, e.g. moonbitlang/x}}" output = "popup" [[tool]] name = "~I~nterfaces" # Regenerates the .mbti files that record each package's public surface. Worth # a menu entry because a diff in one is how a review sees that an API changed. command = "moon info" output = "popup" [[tool]] name = "C~l~ean" command = "moon clean" output = "popup" # A tool naming a `menu` gets a menu of its own on the bar. Nothing above does, # so every tool above is in the MoonBit menu. This one is in a menu called # Tools, which appears between MoonBit and Help — that is the whole mechanism. [[tool]] name = "~E~cho" command = "echo 🎉 tada!" menu = "Tools" output = "terminal"