Sublime Forum

How to automate plugin/package installation with Sublime Text's CLI

#1

Is there a way to 1) get a list of installed plugins/packages and 2) install multiple plugins/packages from a given list, using Sublime Text’s external CLI in Linux systems?

I’m trying to write a simple bash script that sets up my preferred configuration and environment on new installs.
I’m aware one can use the API to some extent with the --command <...> option, but I’m not finding any documentation on the set of commands one can pass as argument.

0 Likes

#2

Why not just placing a proper Package Control.sublime-settings into Packages/User with a list of all packages to install?

That said, commands can be passed as quoted strings with arguments passed as escaped json objects.

All major commands available via Command Palette can be called via CLI.

Some examples are:

subl --command "install_packages {\"packages\": [\"Package 1\", \"Package 2\"], \"unattended\": true }"
subl --command "remove_packages {\"packages\": [\"Package 1\", \"Package 2\"], \"unattended\": true }"
subl --command "upgrade_packages {\"packages\": [\"Package 1\", \"Package 2\"], \"unattended\": true }"

Note, ST should already be running as it otherwise may ignore the commands.

0 Likes