mirror of
https://github.com/wez/wezterm.git
synced 2024-12-18 19:01:36 +03:00
e4ae8a844d
Brief usage notes here: ```lua local wezterm = require 'wezterm' local a_plugin = wezterm.plugin.require "https://github.com/owner/repo" local config = wezterm.config_builder() a_plugin.apply_to_config(config) return config ``` The referenced repo is expected to have a `plugin/init.lua` file, and by convention, return a module that exports an `apply_to_config` function that accepts at least a config builder parameter, but may pass other parameters, or a lua table with a `config` field that maps to a config build parameter. `wezterm.plugin.require` will clone the repo if it doesn't already exist and store it in the runtime dir under `plugins/NAME` where `NAME` is derived from the repo URL. Once cloned, the repo is NOT automatically updated. Only HTTP (or local filesystem) repos are allowed for the git URL; we cannot currently use ssh for this due to conflicting version requirements that I'll take a look at later. `wezterm.plugin.require` will then perform `require "NAME"`, and since the default `package.path` now includes the appropriate location from the runtime dir, the module should load. Two other functions are available: `wezterm.plugin.list()` will list the plugin repos. `wezterm.plugin.update_all()` will attempt to fast-forward or `pull --rebase` each of the repos it finds. It doesn't currently do anything proactive to reload the configuration afterwards; the user will need to do that themselves.
16 lines
424 B
TOML
16 lines
424 B
TOML
[package]
|
|
name = "plugin"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
|
|
[dependencies]
|
|
anyhow = "1.0"
|
|
config = { path = "../../config" }
|
|
git2 = { version = "0.16", default-features = false, features = ["https"] }
|
|
log = "0.4"
|
|
luahelper = { path = "../../luahelper" }
|
|
tempfile = "3.3"
|
|
wezterm-dynamic = { path = "../../wezterm-dynamic" }
|