✨ Improved Command Line Interface#2667
Conversation
- Switched CLI parsing to `commander` library. - Added `--no-auto-update` CLI option. - Added `--with-plugin-files <paths...>` CLI option. - Added `--with-plugin-urls <urls...>` CLI option. - Added optional environment variables that mirror the CLI arguments.
It should *just* output the version, and exit. It was throwing a `CommandError` and printing a bunch of extra text we don't want.
This file might be moved to `blockbench-types` later? Whether or not that happens will be up to @JannisX11
- Added `app.terminal`: A Console instance that always prints to the terminal Blockbench was launched from (console.log switches to the web console after the window opens). - Added `Blockbench.log`: An alias of `app.terminal`. - Added `Plugin.log`: An alias of `Blockbench.log` that adds a `<plugin-id>` prefix to the output. - Added a help option to all commands: `-h, --help`. - Improved error handling, and user feedback when CLI encounters unexpected or unknown arguments. - Added `--open-dev-tools` option: Opens the chrome developer tools on startup.
- Added `--clean-installed-plugins` option: Removes all installed plugins before launching. - Fixed `app.console` references in `plugin_loader.js`. - Replaced `--with-plugin-files` and `--with-plugin-urls` options with `--install-custom-plugins`. - Added `--install-plugins <ids...>` option. - Replaced all (new) `process.exit()` calls with `app.exit()`. - Fixed `Blockbench.log` referencing `app.console` instead of `app.terminal`. -
There was a problem hiding this comment.
ive had to migrate my map back from Smithed Summit work (haven't touched it since november, so ~4 months of afk), but i finally have time to check this out. i know i'm the main audience here so thank you </3
i tried using each CLI option and integrating it with my CI flow (the one that automates Animated Java's export process in Github Actions):
(i kept getting this error when opening dist/win-unpacked/Blockbench.exe through command prompt)

note: i had to update to AJ v1.6.4 (from v1.4.2) in order for my auto-exporter to run. it got some error that i don't think either of us care about given i can just easily update once i update my stuff to use these
clean-installed-plugins: according to the log appears to always run even when i don't specify the flagno-auto-update: seems to work as intended 👍install-custom-plugins: not immediately clear how to specify multiple plugins. comma-separated?
untested args:
open-dev-toolsinstall-plugins(probably useful and good to have as an alternative toinstall-custom-plugins, i just wont need it for my CI process/scripts since i want to tightly control plugin versions)clean-installed-plugins(makes sense, don't think i have a real need for it currently though)userData(would love some elaboration on this, i think i get what it's for but not sure)hidden(i forgot, this one ill probably try using...maybe eventually)
|
also question: is there a significant increase in load time when installing AJ via URL from "clean Blockbench" vs the normal startup AJ needs to do when it's already in Blockbench's plugin list? |
|
Animated Java is the largest plugin ever made for Blockbench. It takes a while to download, then download all of it's required external assets. I haven't noticed any abnormally long delay when testing the CLI URL installation with AJ |
TheAfroOfDoom
left a comment
There was a problem hiding this comment.
praying this gets merged
|
I did a preliminary review of the feature now. Here are my notes. Generally, let's try to integrate the features into Blockbench better so they work in context of the whole program.
|
|
Ahh, all good points. I didn't even consider the web app. How does one run the web app in dev mode? |
|
does it make sense to support a cli in web mode? |
Run
Well there is already support for some URL parameters, like opening a model or installing plugins. But it only makes sense for a limited set of arguments, and requires extra care and/or user confirmation because anyone can make anyone else open a link with those parameters. |
A rewrite of the Blockbench CLI, making it more powerful, and easier to understand.
Notable Changes so Far
commanderlibrary for argument parsing.--no-auto-updateoption: Prevents Blockbench from auto-updating.--install-custom-plugins <paths...>option: Attempts to load the listed file paths or URLs as plugins on startup.--install-plugins <ids...>option: Attempts to install the listed IDs from the official plugins repository on startup.--clean-installed-pluginsoption: Removes all installed plugins before startup.--open-dev-toolsoption: Opens the dev tools on startup.-v, --versionoption: Prints the installed version of Blockbench, then exits.--hiddenoption: Hides the main window.app.terminalconsole instance: Logs output to the terminal Blockbench was launched from with a fancy prefix:[00/00/0000 00:00:00] [Blockbench] ...Blockbench.logfunction: Alias ofapp.terminal.Plugin.logfunction: Alias ofBlockbench.log, but includes the plugin ID in the prefix:[00/00/0000 00:00:00] [Blockbench] <plugin-id> ...BLOCKBENCH_USER_DATAfor--userData.-h, -helpCLI option: