-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
✨ Improved Command Line Interface #2667
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-tools
install-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)
js/cli.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I genuinely have no clue what causes this. I'll dig into it further soon
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 |
A rewrite of the Blockbench CLI, making it more powerful, and easier to understand.
Notable Changes so Far
commander
library for argument parsing.--no-auto-update
option: 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-plugins
option: Removes all installed plugins before startup.--open-dev-tools
option: Opens the dev tools on startup.-v, --version
option: Prints the installed version of Blockbench, then exits.--hidden
option: Hides the main window.app.terminal
console instance: Logs output to the terminal Blockbench was launched from with a fancy prefix:[00/00/0000 00:00:00] [Blockbench] ...
Blockbench.log
function: Alias ofapp.terminal
.Plugin.log
function: Alias ofBlockbench.log
, but includes the plugin ID in the prefix:[00/00/0000 00:00:00] [Blockbench] <plugin-id> ...
BLOCKBENCH_USER_DATA
for--userData
.-h, -help
CLI option: