mirror of
https://github.com/zellij-org/zellij.git
synced 2026-10-11 22:50:07 +00:00
fix(build): remove manpage, honor CARGO_TARGET_DIR, add cargo argument passthrough, remove clippy (#5426)
* fix(build): remove manpage, honor CARGO_TARGET_DIR, add cargo argument passthrough, remove clippy * add pr
This commit is contained in:
@@ -4,4 +4,3 @@ target/
|
||||
.vim
|
||||
.idea
|
||||
.DS_Store
|
||||
/assets/man/zellij.1
|
||||
|
||||
@@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
* chore: switch cassowary deps to maintained fork kasuari (https://github.com/zellij-org/zellij/pull/5416)
|
||||
* chore: switch unmaintained daemonize with maintained fork daemonix (https://github.com/zellij-org/zellij/pull/4512)
|
||||
* feat: handle nested Zellij sessions (https://github.com/zellij-org/zellij/pull/5417)
|
||||
* chore: remove outdated manpage and some build fixes (https://github.com/zellij-org/zellij/pull/5426)
|
||||
|
||||
## [0.44.3] - 2026-05-13
|
||||
* fix(windows): bump windows-sys to 0.59 to align manifest with code, fixing source builds via `cargo install`/`cargo binstall` (https://github.com/zellij-org/zellij/pull/5139)
|
||||
|
||||
+1
-16
@@ -22,15 +22,12 @@ If you're still eager to contribute minor fixes, please note that we might take
|
||||
To build Zellij, we're using cargo xtask. This is a standalone package shipped
|
||||
inside the repository, so you don't have to install additional dependencies.
|
||||
|
||||
To edit our manpage, the mandown crate (`cargo install --locked
|
||||
mandown`) is used and the work is done on a markdown file in docs/MANPAGE.md.
|
||||
|
||||
To build zellij, you'll need [`protoc`](https://github.com/protocolbuffers/protobuf#protobuf-compiler-installation) installed. This is used to compile the .proto files into Rust assets. These protocol buffers are used for communication between Zellij and its plugins across the wasm boundary.
|
||||
|
||||
Here are some of the commands currently supported by the build system:
|
||||
|
||||
```sh
|
||||
# Format code, build, then run tests and clippy
|
||||
# Format code, build, then run tests
|
||||
cargo xtask
|
||||
# You can also perform these actions individually
|
||||
cargo xtask format
|
||||
@@ -39,14 +36,10 @@ cargo xtask test
|
||||
# Run Zellij (optionally with additional arguments)
|
||||
cargo xtask run
|
||||
cargo xtask run -- -l strider
|
||||
# Run Clippy
|
||||
cargo xtask clippy
|
||||
# Install Zellij to some directory
|
||||
cargo xtask install /path/of/zellij/binary
|
||||
# Publish the zellij and zellij-tile crates
|
||||
cargo xtask publish
|
||||
# Update manpage
|
||||
cargo xtask manpage
|
||||
```
|
||||
|
||||
You can see a list of all commands (with supported arguments) with `cargo xtask
|
||||
@@ -98,14 +91,6 @@ To enable the singlepass compiler, use the `singlepass` flag. E.g.:
|
||||
cargo xtask run --singlepass
|
||||
```
|
||||
|
||||
## How we treat clippy lints
|
||||
|
||||
We currently use clippy in [GitHub Actions](https://github.com/zellij-org/zellij/blob/main/.github/workflows/rust.yml) with the default settings that report only [`clippy::correctness`](https://github.com/rust-lang/rust-clippy#readme) as errors and other lints as warnings because Zellij is still unstable. This means that all warnings can be ignored depending on the situation at that time, even though they are also helpful to keep the code quality.
|
||||
Since we just cannot afford to manage them, we are always welcome to fix them!
|
||||
|
||||
Here is [the detailed discussion](https://github.com/zellij-org/zellij/pull/1090) if you want to see it.
|
||||
|
||||
|
||||
## Toolchain Versions and MSRV
|
||||
|
||||
Development aims to track the current stable Rust toolchain version, although
|
||||
|
||||
@@ -139,15 +139,9 @@ codegen-units = 1
|
||||
depends = "$auto"
|
||||
license-file = ["LICENSE.md", "4"]
|
||||
assets = [
|
||||
["assets/man/zellij.1", "usr/share/man/man1/zellij.1", "644"],
|
||||
["target/release/zellij", "usr/bin/zellij", "755"],
|
||||
["GOVERNANCE.md", "usr/share/doc/zellij/GOVERNANCE.md", "644"],
|
||||
["README.md", "usr/share/doc/zellij/README.md", "644"],
|
||||
["assets/layouts/*", "usr/share/zellij/layouts/", "644"],
|
||||
["assets/plugins/*", "usr/share/zellij/plugins/", "644"],
|
||||
["assets/completions/zellij.bash", "usr/share/bash-completion/completions/zellij.bash", "644"],
|
||||
["assets/completions/zellij.fish", "usr/share/fish/vendor_completions.d/zellij.fish", "644"],
|
||||
["assets/completions/_zellij", "usr/share/zsh/vendor-completions/_zellij", "644"],
|
||||
]
|
||||
|
||||
[package.metadata.binstall]
|
||||
|
||||
-308
@@ -1,308 +0,0 @@
|
||||
NAME
|
||||
====
|
||||
|
||||
**zellij** - run zellij
|
||||
|
||||
DESCRIPTION
|
||||
===========
|
||||
|
||||
Zellij is a workspace aimed at developers, ops-oriented people and anyone who
|
||||
loves the terminal. At its core, it is a terminal multiplexer (similar to tmux
|
||||
and screen), but this is merely its infrastructure layer.
|
||||
|
||||
Zellij includes a layout system, and a plugin system allowing one to create
|
||||
plugins in any language that compiles to WebAssembly.
|
||||
|
||||
To list currently running sessions run: `zellij list-sessions`
|
||||
To attach to a currently running session run: `zellij attach [session-name]`
|
||||
|
||||
OPTIONS
|
||||
=======
|
||||
|
||||
Run `zellij --help` to see available flags and subcommamds.
|
||||
|
||||
CONFIGURATION
|
||||
=============
|
||||
|
||||
Zellij looks for configuration file in the following order:
|
||||
|
||||
1. the file provided with _--config_
|
||||
2. under the path provided in *ZELLIJ_CONFIG_FILE* environment variable
|
||||
3. the default location (see FILES section)
|
||||
4. the system location
|
||||
|
||||
Run `zellij setup --check` in order to see possible issues with the
|
||||
configuration.
|
||||
|
||||
LAYOUTS
|
||||
=======
|
||||
|
||||
Layouts are yaml files which Zellij can load on startup when _--layout_ flag is
|
||||
provided.
|
||||
By default Zellij will load a layout called `default.yaml`,
|
||||
but this can be changed by using the `default_layout: [LAYOUT_NAME]` configuration option.
|
||||
|
||||
|
||||
For example a file like this:
|
||||
```
|
||||
---
|
||||
direction: Vertical
|
||||
parts:
|
||||
- direction: Horizontal
|
||||
split_size:
|
||||
Percent: 50
|
||||
parts:
|
||||
- direction: Vertical
|
||||
split_size:
|
||||
Percent: 50
|
||||
- direction: Vertical
|
||||
split_size:
|
||||
Percent: 50
|
||||
- direction: Horizontal
|
||||
split_size:
|
||||
Percent: 50
|
||||
```
|
||||
|
||||
will tell Zellij to create this layout:
|
||||
```
|
||||
┌─────┬─────┐
|
||||
│ │ │
|
||||
├─────┤ │
|
||||
│ │ │
|
||||
└─────┴─────┘
|
||||
```
|
||||
|
||||
CREATING LAYOUTS
|
||||
----------------
|
||||
|
||||
A layout file is a nested tree structure. Each node describes either a pane
|
||||
(leaf), or a space in which its parts (children) will be created.
|
||||
|
||||
Each node has following fields:
|
||||
* __direction: <Horizontal / Vertical\>__ - node's children will be created by a
|
||||
split in given direction.
|
||||
* **split_size:** - this indicates either a percentage of the node's parent's
|
||||
space or a fixed size of columns/rows from its parent's space.
|
||||
* __Percent: <1-100\>__
|
||||
* __Fixed: <lines_number/columns_number\>__
|
||||
* __plugin: /path/to/plugin.wasm__ - optional path to a compiled Zellij plugin.
|
||||
If indicated loads a plugin into the created space. For more information see
|
||||
PLUGINS section.
|
||||
* __default_fg: \<color\>__ - set the default foreground color for a pane (e.g. `"#00e000"`).
|
||||
* __default_bg: \<color\>__ - set the default background color for a pane (e.g. `"#001a3a"`).
|
||||
|
||||
KEYBINDINGS
|
||||
===========
|
||||
|
||||
Zellij comes with a default set of keybindings which aims to fit as many users
|
||||
as possible but that behaviour can be overridden or modified in user
|
||||
configuration files. The information about bindings is available in the
|
||||
_keybinds_ section of configuration. For example, to introduce a keybinding that
|
||||
will create a new tab and go to tab 1 after pressing 'c' one can write:
|
||||
|
||||
```
|
||||
keybinds:
|
||||
normal:
|
||||
- action: [ NewTab, GoToTab: 1,]
|
||||
key: [ Char: 'c',]
|
||||
```
|
||||
|
||||
where "normal" stands for a mode name (see MODES section), "action" part
|
||||
specifies the actions to be executed by Zellij (see ACTIONS section) and "key"
|
||||
is used to list keys or key combinations bound to given actions (see KEYS).
|
||||
|
||||
The default keybinds can be unbound either for a specific mode, or for every mode.
|
||||
It supports either a list of `keybinds`, or a bool indicating that every keybind
|
||||
should be unbound:
|
||||
|
||||
```
|
||||
keybinds:
|
||||
unbind: true
|
||||
```
|
||||
Will unbind every default binding.
|
||||
|
||||
```
|
||||
keybinds:
|
||||
unbind: [ Ctrl: 'p']
|
||||
```
|
||||
Will unbind every default `^P` binding for each mode.
|
||||
```
|
||||
keybinds:
|
||||
normal:
|
||||
- unbind: true
|
||||
```
|
||||
Will unbind every default keybind for the `normal` mode.
|
||||
```
|
||||
keybinds:
|
||||
normal:
|
||||
- unbind: [ Alt: 'n', Ctrl: 'g']
|
||||
```
|
||||
Will unbind every default keybind for `n` and `^g` for the `normal` mode.
|
||||
|
||||
ACTIONS
|
||||
-------
|
||||
|
||||
* __Quit__ - quits Zellij
|
||||
* __SwitchToMode: <InputMode\>__ - switches to the specified input mode. See
|
||||
MODES section for possible values.
|
||||
* __Resize: <Direction\>__ - resizes focused pane in the specified direction
|
||||
(one of: Left, Right, Up, Down).
|
||||
* __FocusNextPane__ - switches focus to the next pane to the right or below if
|
||||
on screen edge.
|
||||
* __FocusPreviousPane__ - switches focus to the next pane to the left or above
|
||||
if on screen edge.
|
||||
* __FocusLastPane__ - switches focus to the previously focused pane.
|
||||
* __SwitchFocus__ - left for legacy support. Switches focus to a pane with the
|
||||
next ID.
|
||||
* __MoveFocus: <Direction\>__ - moves focus in the specified direction (Left,
|
||||
Right, Up, Down).
|
||||
* __Clear__ - clears current screen.
|
||||
* __DumpScreen: [File\] [--pane-id <ID\>]__ - dumps the pane content to a file or STDOUT.
|
||||
If a file path is provided, writes the content to that file. If omitted, prints the content to STDOUT.
|
||||
If --pane-id is provided, dumps the specified pane; otherwise dumps the focused pane.
|
||||
<ID\> can be a bare integer (eg. 1), a terminal pane id (eg. terminal_1) or a plugin pane id (eg. plugin_1).
|
||||
A bare integer is equivalent to a terminal pane id with the same number.
|
||||
* __DumpLayout: <File\>__ - dumps the screen in the specified or default file.
|
||||
* __EditScrollback__ - replaces the current pane with the scrollback buffer.
|
||||
* __ScrollUp__ - scrolls up 1 line in the focused pane.
|
||||
* __ScrollDown__ - scrolls down 1 line in the focused pane.
|
||||
* __PageScrollUp__ - scrolls up 1 page in the focused pane.
|
||||
* __PageScrollDown__ - scrolls down 1 page in the focused pane.
|
||||
* __ToggleFocusFullscreen__ - toggles between fullscreen focus pane and normal
|
||||
layout.
|
||||
* __NewPane: <Direction\>__ - opens a new pane in the specified direction (Left,
|
||||
Right, Up, Down) relative to focus.
|
||||
* __CloseFocus__ - closes focused pane.
|
||||
* __NewTab__ - creates a new tab.
|
||||
* __GoToNextTab__ - goes to the next tab.
|
||||
* __GoToPreviousTab__ - goes to previous tab.
|
||||
* __CloseTab__ - closes current tab.
|
||||
* __GoToTab: <Index\>__ - goes to the tab with the specified index number.
|
||||
* __Detach__ - detach session and exit.
|
||||
* __ToggleActiveSyncTab__ - toggle between sending text commands to all panes
|
||||
on the current tab and normal mode.
|
||||
* __UndoRenameTab__ - undoes the changed tab name and reverts to the previous name.
|
||||
* __UndoRenamePane__ - undoes the changed pane name and reverts to the previous name.
|
||||
* __SetPaneColor__ - sets the default foreground and/or background color of a pane.
|
||||
|
||||
|
||||
KEYS
|
||||
----
|
||||
|
||||
* __Char: <character\>__ - a single character with no modifier.
|
||||
* __Alt: <character\>__ - a single character with `Alt` key as modifier.
|
||||
* __Ctrl: <character\>__ - a single character with `Ctrl` key as modifier.
|
||||
* __F: <1-12\>__ - one of `F` keys (usually at the top of the keyboard).
|
||||
* __Backspace__
|
||||
* __Left / Right / Up / Down__ - arrow keys on the keyboard.
|
||||
* __Home__
|
||||
* __End__
|
||||
* __PageUp / PageDown__
|
||||
* __BackTab__ - a backward Tab key.
|
||||
* __Delete__
|
||||
* __Insert__
|
||||
* __Esc__
|
||||
|
||||
|
||||
MODES
|
||||
-----
|
||||
|
||||
* __normal__ - the default startup mode of Zellij. Provides the ability to
|
||||
switch to different modes, as well as some quick navigation shortcuts.
|
||||
* __locked__ - disables all keybindings except the one that would switch the
|
||||
mode to normal (_ctrl-g_ by default). Useful when Zellij's keybindings
|
||||
conflict with those of a chosen terminal app.
|
||||
* __tmux__ - provides convenience keybindings emulating simple tmux behaviour
|
||||
* __pane__ - includes instructions that manipulate the panes (adding new panes,
|
||||
moving, closing).
|
||||
* __tab__ - includes instructions that manipulate the tabs (adding new tabs,
|
||||
moving, closing).
|
||||
* __resize__ - allows resizing of the focused pane.
|
||||
* __scroll__ - allows scrolling within the focused pane.
|
||||
* __renametab__ - is a "hidden" mode that can be passed to _SwitchToMode_
|
||||
action. It will trigger renaming of a tab.
|
||||
* __renamepane__ - is a "hidden" mode that can be passed to _SwitchToMode_
|
||||
action. It will trigger renaming of a pane.
|
||||
* __session__ - allows detaching from a session.
|
||||
|
||||
|
||||
Theme
|
||||
=====
|
||||
A color theme can be defined either in truecolor, 256 or hex color format.
|
||||
Truecolor:
|
||||
```
|
||||
fg: [0, 0, 0]
|
||||
```
|
||||
256:
|
||||
```
|
||||
fg: 0
|
||||
```
|
||||
Hex color:
|
||||
```
|
||||
fg: "#000000"
|
||||
bg: "#000"
|
||||
```
|
||||
The color theme can be specified in the following way:
|
||||
```
|
||||
themes:
|
||||
default:
|
||||
fg: [0,0,0]
|
||||
bg: [0,0,0]
|
||||
black: [0,0,0]
|
||||
red: [0,0,0]
|
||||
green: [0,0,0]
|
||||
yellow: [0,0,0]
|
||||
blue: [0,0,0]
|
||||
magenta: [0,0,0]
|
||||
cyan: [0,0,0]
|
||||
white: [0,0,0]
|
||||
orange: [0,0,0]
|
||||
```
|
||||
|
||||
If the theme is called `default`, then zellij will pick it on startup.
|
||||
To specify a different theme, run zellij with:
|
||||
```
|
||||
zellij options --theme [NAME]
|
||||
```
|
||||
or put the name in the configuration file with `theme: [NAME]`.
|
||||
|
||||
PLUGINS
|
||||
=======
|
||||
|
||||
Zellij has a plugin system based on WebAssembly. Any language that can run on
|
||||
WASI can be used to develop a plugin. To load a plugin include it in a layout
|
||||
file. Zellij comes with default plugins included: _status-bar_, _strider_,
|
||||
_tab-bar_.
|
||||
|
||||
FILES
|
||||
=====
|
||||
|
||||
Default user configuration directory location:
|
||||
* Linux: _$XDG_HOME/zellij /home/alice/.config/zellij_
|
||||
* macOS: _/Users/Alice/Library/Application Support/com.Zellij-Contributors.zellij_
|
||||
|
||||
Default user layout directory location:
|
||||
* Subdirectory called `layouts` inside of the configuration directory.
|
||||
* Linux: _$XDG_HOME/zellij/layouts /home/alice/.config/zellij/layouts
|
||||
* macOS: _/Users/Alice/Library/Application/layouts Support/com.Zellij-Contributors.zellij/layouts_
|
||||
|
||||
Default plugin directory location:
|
||||
* Linux: _$XDG_DATA_HOME/zellij/plugins /home/alice/.local/share/plugins
|
||||
|
||||
|
||||
ENVIRONMENT
|
||||
===========
|
||||
ZELLIJ_CONFIG_FILE
|
||||
Path of Zellij config to load.
|
||||
ZELLIJ_CONFIG_DIR
|
||||
Path of the Zellij config directory.
|
||||
|
||||
|
||||
|
||||
NOTES
|
||||
=====
|
||||
|
||||
The manpage is meant to provide concise offline reference. For more detailed
|
||||
instructions please visit:
|
||||
|
||||
https://zellij.dev/documentation
|
||||
+7
-47
@@ -3,7 +3,6 @@
|
||||
//! Currently has the following functions:
|
||||
//!
|
||||
//! - [`build`]: Builds general cargo projects (i.e. zellij components) with `cargo build`
|
||||
//! - [`manpage`]: Builds the manpage with `mandown`
|
||||
use crate::{flags, metadata, WorkspaceMember};
|
||||
use anyhow::Context;
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -99,6 +98,7 @@ pub fn build(sh: &Shell, flags: flags::Build) -> anyhow::Result<()> {
|
||||
},
|
||||
}
|
||||
}
|
||||
base_cmd = base_cmd.args(&flags.args);
|
||||
base_cmd.run().with_context(err_context)?;
|
||||
}
|
||||
}
|
||||
@@ -218,11 +218,7 @@ fn plugin_name_of(member: &WorkspaceMember) -> anyhow::Result<&'static str> {
|
||||
}
|
||||
|
||||
fn plugin_stamp_path() -> PathBuf {
|
||||
PathBuf::from(
|
||||
std::env::var_os("CARGO_TARGET_DIR")
|
||||
.unwrap_or(crate::project_root().join("target").into_os_string()),
|
||||
)
|
||||
.join(".xtask-plugins-stamp")
|
||||
crate::target_dir().join(".xtask-plugins-stamp")
|
||||
}
|
||||
|
||||
fn write_plugin_stamp(sh: &Shell) {
|
||||
@@ -322,14 +318,11 @@ fn move_plugin_to_assets(sh: &Shell, plugin_name: &str) -> anyhow::Result<()> {
|
||||
.with_extension("wasm");
|
||||
|
||||
// Get plugin path
|
||||
let plugin = PathBuf::from(
|
||||
std::env::var_os("CARGO_TARGET_DIR")
|
||||
.unwrap_or(crate::project_root().join("target").into_os_string()),
|
||||
)
|
||||
.join("wasm32-wasip1")
|
||||
.join("release")
|
||||
.join(plugin_name)
|
||||
.with_extension("wasm");
|
||||
let plugin = crate::target_dir()
|
||||
.join("wasm32-wasip1")
|
||||
.join("release")
|
||||
.join(plugin_name)
|
||||
.with_extension("wasm");
|
||||
|
||||
if !plugin.is_file() {
|
||||
return Err(anyhow::anyhow!("No plugin found at '{}'", plugin.display()))
|
||||
@@ -341,36 +334,3 @@ fn move_plugin_to_assets(sh: &Shell, plugin_name: &str) -> anyhow::Result<()> {
|
||||
let to = asset_name.as_path();
|
||||
sh.copy_file(from, to).with_context(err_context)
|
||||
}
|
||||
|
||||
/// Build the manpage with `mandown`.
|
||||
// mkdir -p ${root_dir}/assets/man
|
||||
// mandown ${root_dir}/docs/MANPAGE.md 1 > ${root_dir}/assets/man/zellij.1
|
||||
pub fn manpage(sh: &Shell) -> anyhow::Result<()> {
|
||||
let err_context = "failed to generate manpage";
|
||||
|
||||
let mandown = mandown(sh).context(err_context)?;
|
||||
|
||||
let project_root = crate::project_root();
|
||||
let asset_dir = &project_root.join("assets").join("man");
|
||||
sh.create_dir(asset_dir).context(err_context)?;
|
||||
let _pd = sh.push_dir(asset_dir);
|
||||
|
||||
cmd!(sh, "{mandown} {project_root}/docs/MANPAGE.md 1")
|
||||
.read()
|
||||
.and_then(|text| sh.write_file("zellij.1", text))
|
||||
.context(err_context)
|
||||
}
|
||||
|
||||
/// Get the path to a `mandown` executable.
|
||||
///
|
||||
/// If the executable isn't found, an error is returned instead.
|
||||
fn mandown(_sh: &Shell) -> anyhow::Result<PathBuf> {
|
||||
match which::which("mandown") {
|
||||
Ok(path) => Ok(path),
|
||||
Err(e) => {
|
||||
eprintln!("!! 'mandown' wasn't found but is needed for this build step.");
|
||||
eprintln!("!! Please install it with: `cargo install mandown`");
|
||||
Err(e).context("Couldn't find 'mandown' executable")
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
+4
-6
@@ -55,6 +55,7 @@ fn e2e_build(sh: &Shell) -> anyhow::Result<()> {
|
||||
no_plugins: false,
|
||||
plugins_only: true,
|
||||
no_web: false,
|
||||
args: vec![],
|
||||
},
|
||||
)
|
||||
.context(err_context)?;
|
||||
@@ -62,7 +63,7 @@ fn e2e_build(sh: &Shell) -> anyhow::Result<()> {
|
||||
// Copy plugins to e2e data-dir
|
||||
let plugin_dir = crate::asset_dir().join("plugins");
|
||||
let project_root = crate::project_root();
|
||||
let data_dir = project_root.join("target").join("e2e-data");
|
||||
let data_dir = crate::target_dir().join("e2e-data");
|
||||
let plugins: Vec<_> = std::fs::read_dir(plugin_dir)
|
||||
.context(err_context)?
|
||||
.filter_map(|dir_entry| {
|
||||
@@ -153,6 +154,7 @@ fn build_release(sh: &Shell, no_web: bool) -> anyhow::Result<()> {
|
||||
no_plugins: false,
|
||||
plugins_only: true,
|
||||
no_web,
|
||||
args: vec![],
|
||||
},
|
||||
)
|
||||
.context(err_context)?;
|
||||
@@ -227,10 +229,6 @@ fn cross_compile(sh: &Shell, target: &OsString, no_web: bool) -> anyhow::Result<
|
||||
let err_context = || format!("failed to cross-compile for {target:?}");
|
||||
|
||||
crate::cargo()
|
||||
.and_then(|cargo| {
|
||||
cmd!(sh, "{cargo} install mandown").run()?;
|
||||
Ok(cargo)
|
||||
})
|
||||
.and_then(|cargo| {
|
||||
cmd!(sh, "{cargo} install cross")
|
||||
.run()
|
||||
@@ -245,9 +243,9 @@ fn cross_compile(sh: &Shell, target: &OsString, no_web: bool) -> anyhow::Result<
|
||||
no_plugins: false,
|
||||
plugins_only: true,
|
||||
no_web,
|
||||
args: vec![],
|
||||
},
|
||||
)
|
||||
.and_then(|_| build::manpage(sh))
|
||||
.with_context(err_context)?;
|
||||
|
||||
cross()
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
//! Handle running `cargo clippy` on the sources.
|
||||
use crate::{build, flags, WorkspaceMember};
|
||||
use anyhow::Context;
|
||||
use std::path::{Path, PathBuf};
|
||||
use xshell::{cmd, Shell};
|
||||
|
||||
pub fn clippy(sh: &Shell, _flags: flags::Clippy) -> anyhow::Result<()> {
|
||||
let _pd = sh.push_dir(crate::project_root());
|
||||
|
||||
build::build(
|
||||
sh,
|
||||
flags::Build {
|
||||
release: false,
|
||||
no_plugins: false,
|
||||
plugins_only: true,
|
||||
no_web: false,
|
||||
},
|
||||
)
|
||||
.context("failed to run task 'clippy'")?;
|
||||
|
||||
let cargo = check_clippy()
|
||||
.and_then(|_| crate::cargo())
|
||||
.context("failed to run task 'clippy'")?;
|
||||
|
||||
for WorkspaceMember { crate_name, .. } in crate::workspace_members().iter() {
|
||||
let _pd = sh.push_dir(Path::new(crate_name));
|
||||
// Tell the user where we are now
|
||||
println!();
|
||||
let msg = format!(">> Running clippy on '{crate_name}'");
|
||||
crate::status(&msg);
|
||||
println!("{}", msg);
|
||||
|
||||
cmd!(sh, "{cargo} clippy --all-targets --all-features")
|
||||
.run()
|
||||
.with_context(|| format!("failed to run task 'clippy' on '{crate_name}'"))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn check_clippy() -> anyhow::Result<PathBuf> {
|
||||
which::which("cargo-clippy").context(
|
||||
"Couldn't find 'clippy' executable. Please install it with `rustup component add clippy`",
|
||||
)
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
+12
-22
@@ -39,9 +39,6 @@ xflags::xflags! {
|
||||
}
|
||||
}
|
||||
|
||||
/// Build the manpage
|
||||
cmd manpage {}
|
||||
|
||||
cmd proto {}
|
||||
|
||||
/// Publish zellij and all the sub-crates
|
||||
@@ -56,13 +53,7 @@ xflags::xflags! {
|
||||
optional --cargo-registry registry: OsString
|
||||
}
|
||||
|
||||
/// Package zellij for distribution (result found in ./target/dist)
|
||||
cmd dist {}
|
||||
|
||||
/// Run `cargo clippy` on all crates
|
||||
cmd clippy {}
|
||||
|
||||
/// Sequentially call: format, build, test, clippy
|
||||
/// Sequentially call: format, build, test
|
||||
cmd make {
|
||||
/// Build in release mode without debug symbols
|
||||
optional -r, --release
|
||||
@@ -77,6 +68,10 @@ xflags::xflags! {
|
||||
required destination: PathBuf
|
||||
/// Compile without web server support
|
||||
optional --no-web
|
||||
/// Extra arguments appended to the native `cargo build` invocation
|
||||
/// (e.g. `--no-default-features`, `--features ...`, `--offline`, `--locked`, `-j N`).
|
||||
/// Not applied to the wasm plugin build.
|
||||
repeated args: OsString
|
||||
}
|
||||
|
||||
/// Run debug version of zellij
|
||||
@@ -128,6 +123,10 @@ xflags::xflags! {
|
||||
optional --no-plugins
|
||||
/// Compile without web support
|
||||
optional --no-web
|
||||
/// Extra arguments appended to the native `cargo build` invocation
|
||||
/// (e.g. `--no-default-features`, `--features ...`, `--offline`, `--locked`, `-j N`).
|
||||
/// Not applied to the wasm plugin build.
|
||||
repeated args: OsString
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,11 +142,8 @@ pub struct Xtask {
|
||||
pub enum XtaskCmd {
|
||||
Deprecated(Deprecated),
|
||||
Ci(Ci),
|
||||
Manpage(Manpage),
|
||||
Proto(Proto),
|
||||
Publish(Publish),
|
||||
Dist(Dist),
|
||||
Clippy(Clippy),
|
||||
Make(Make),
|
||||
Install(Install),
|
||||
Run(Run),
|
||||
@@ -194,9 +190,6 @@ pub struct BuildRelease {
|
||||
pub no_web: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Manpage;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Proto;
|
||||
|
||||
@@ -208,12 +201,6 @@ pub struct Publish {
|
||||
pub cargo_registry: Option<OsString>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Dist;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Clippy;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Make {
|
||||
pub release: bool,
|
||||
@@ -224,6 +211,7 @@ pub struct Make {
|
||||
#[derive(Debug)]
|
||||
pub struct Install {
|
||||
pub destination: PathBuf,
|
||||
pub args: Vec<OsString>,
|
||||
|
||||
pub no_web: bool,
|
||||
}
|
||||
@@ -260,6 +248,8 @@ pub struct IntegrationTest {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Build {
|
||||
pub args: Vec<OsString>,
|
||||
|
||||
pub release: bool,
|
||||
pub plugins_only: bool,
|
||||
pub no_plugins: bool,
|
||||
|
||||
+7
-8
@@ -8,8 +8,6 @@
|
||||
|
||||
mod build;
|
||||
mod ci;
|
||||
mod clippy;
|
||||
mod dist;
|
||||
mod flags;
|
||||
mod format;
|
||||
mod integration_test;
|
||||
@@ -127,13 +125,10 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
match flags.subcommand {
|
||||
flags::XtaskCmd::Deprecated(_flags) => deprecation_notice(),
|
||||
flags::XtaskCmd::Dist(flags) => pipelines::dist(shell, flags),
|
||||
flags::XtaskCmd::Build(flags) => build::build(shell, flags),
|
||||
flags::XtaskCmd::Clippy(flags) => clippy::clippy(shell, flags),
|
||||
flags::XtaskCmd::Format(flags) => format::format(shell, flags),
|
||||
flags::XtaskCmd::Test(flags) => test::test(shell, flags),
|
||||
flags::XtaskCmd::IntegrationTest(flags) => integration_test::integration_test(shell, flags),
|
||||
flags::XtaskCmd::Manpage(_flags) => build::manpage(shell),
|
||||
flags::XtaskCmd::Proto(_flags) => build::proto(shell),
|
||||
// Pipelines
|
||||
// These are composite commands, made up of multiple "stages" defined above.
|
||||
@@ -164,6 +159,13 @@ fn asset_dir() -> PathBuf {
|
||||
crate::project_root().join("zellij-utils").join("assets")
|
||||
}
|
||||
|
||||
pub fn target_dir() -> PathBuf {
|
||||
match env::var_os("CARGO_TARGET_DIR") {
|
||||
Some(dir) => PathBuf::from(dir),
|
||||
None => crate::project_root().join("target"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cargo() -> anyhow::Result<PathBuf> {
|
||||
std::env::var_os("CARGO")
|
||||
.map_or_else(|| which::which("cargo"), |exe| Ok(PathBuf::from(exe)))
|
||||
@@ -193,11 +195,8 @@ anything!
|
||||
| make test | xtask test |
|
||||
| make run | xtask run |
|
||||
| make run -l strider | xtask run -- -l strider |
|
||||
| make clippy | xtask clippy |
|
||||
| make clippy -W clippy::pedantic | N/A |
|
||||
| make install /path/to/binary | xtask install /path/to/binary |
|
||||
| make publish | xtask publish |
|
||||
| make manpage | xtask manpage |
|
||||
|
||||
|
||||
In order to disable xtask during the transitioning period: Delete/comment the
|
||||
|
||||
+11
-41
@@ -1,7 +1,7 @@
|
||||
//! Composite pipelines for the build system.
|
||||
//!
|
||||
//! Defines multiple "pipelines" that run specific individual steps in sequence.
|
||||
use crate::{build, clippy, format, metadata, test};
|
||||
use crate::{build, format, metadata, test};
|
||||
use crate::{flags, WorkspaceMember};
|
||||
use anyhow::Context;
|
||||
use xshell::{cmd, Shell};
|
||||
@@ -13,7 +13,6 @@ use xshell::{cmd, Shell};
|
||||
/// - format
|
||||
/// - build
|
||||
/// - test
|
||||
/// - clippy
|
||||
pub fn make(sh: &Shell, flags: flags::Make) -> anyhow::Result<()> {
|
||||
let err_context = || format!("failed to run pipeline 'make' with args {flags:?}");
|
||||
|
||||
@@ -32,6 +31,7 @@ pub fn make(sh: &Shell, flags: flags::Make) -> anyhow::Result<()> {
|
||||
no_plugins: false,
|
||||
plugins_only: false,
|
||||
no_web: flags.no_web,
|
||||
args: vec![],
|
||||
},
|
||||
)
|
||||
})
|
||||
@@ -44,7 +44,6 @@ pub fn make(sh: &Shell, flags: flags::Make) -> anyhow::Result<()> {
|
||||
},
|
||||
)
|
||||
})
|
||||
.and_then(|_| clippy::clippy(sh, flags::Clippy {}))
|
||||
.with_context(err_context)
|
||||
}
|
||||
|
||||
@@ -54,7 +53,6 @@ pub fn make(sh: &Shell, flags: flags::Make) -> anyhow::Result<()> {
|
||||
///
|
||||
/// - [`build`](build::build) (release, plugins only)
|
||||
/// - [`build`](build::build) (release, without plugins)
|
||||
/// - [`manpage`](build::manpage)
|
||||
/// - Copy the executable to [target file](flags::Install::destination)
|
||||
pub fn install(sh: &Shell, flags: flags::Install) -> anyhow::Result<()> {
|
||||
let err_context = || format!("failed to run pipeline 'install' with args {flags:?}");
|
||||
@@ -67,6 +65,7 @@ pub fn install(sh: &Shell, flags: flags::Install) -> anyhow::Result<()> {
|
||||
no_plugins: false,
|
||||
plugins_only: true,
|
||||
no_web: flags.no_web,
|
||||
args: vec![],
|
||||
},
|
||||
)
|
||||
.and_then(|_| {
|
||||
@@ -78,13 +77,10 @@ pub fn install(sh: &Shell, flags: flags::Install) -> anyhow::Result<()> {
|
||||
no_plugins: true,
|
||||
plugins_only: false,
|
||||
no_web: flags.no_web,
|
||||
args: flags.args.clone(),
|
||||
},
|
||||
)
|
||||
})
|
||||
.and_then(|_| {
|
||||
// Generate man page
|
||||
build::manpage(sh)
|
||||
})
|
||||
.with_context(err_context)?;
|
||||
|
||||
// Copy binary to destination
|
||||
@@ -96,8 +92,11 @@ pub fn install(sh: &Shell, flags: flags::Install) -> anyhow::Result<()> {
|
||||
.join(&flags.destination)
|
||||
};
|
||||
sh.change_dir(crate::project_root());
|
||||
sh.copy_file("target/release/zellij", &destination)
|
||||
.with_context(err_context)
|
||||
sh.copy_file(
|
||||
crate::target_dir().join("release").join("zellij"),
|
||||
&destination,
|
||||
)
|
||||
.with_context(err_context)
|
||||
}
|
||||
|
||||
/// Run zellij debug build.
|
||||
@@ -148,6 +147,7 @@ pub fn run(sh: &Shell, mut flags: flags::Run) -> anyhow::Result<()> {
|
||||
no_plugins: false,
|
||||
plugins_only: true,
|
||||
no_web: flags.no_web,
|
||||
args: vec![],
|
||||
},
|
||||
)
|
||||
.and_then(|_| crate::cargo())
|
||||
@@ -193,37 +193,6 @@ pub fn run(sh: &Shell, mut flags: flags::Run) -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Bundle all distributable content to `target/dist`.
|
||||
///
|
||||
/// This includes the optimized zellij executable from the [`install`] pipeline, the man page, the
|
||||
/// `.desktop` file and the application logo.
|
||||
pub fn dist(sh: &Shell, _flags: flags::Dist) -> anyhow::Result<()> {
|
||||
let err_context = || "failed to run pipeline 'dist'";
|
||||
|
||||
sh.change_dir(crate::project_root());
|
||||
if sh.path_exists("target/dist") {
|
||||
sh.remove_path("target/dist").with_context(err_context)?;
|
||||
}
|
||||
sh.create_dir("target/dist")
|
||||
.map_err(anyhow::Error::new)
|
||||
.and_then(|_| {
|
||||
install(
|
||||
sh,
|
||||
flags::Install {
|
||||
destination: crate::project_root().join("./target/dist/zellij"),
|
||||
no_web: false,
|
||||
},
|
||||
)
|
||||
})
|
||||
.with_context(err_context)?;
|
||||
|
||||
sh.create_dir("target/dist/man")
|
||||
.and_then(|_| sh.copy_file("assets/man/zellij.1", "target/dist/man/zellij.1"))
|
||||
.and_then(|_| sh.copy_file("assets/zellij.desktop", "target/dist/zellij.desktop"))
|
||||
.and_then(|_| sh.copy_file("assets/logo.png", "target/dist/logo.png"))
|
||||
.with_context(err_context)
|
||||
}
|
||||
|
||||
/// Actions for the user to choose from to resolve publishing errors/conflicts.
|
||||
enum UserAction {
|
||||
Retry,
|
||||
@@ -323,6 +292,7 @@ pub fn publish(sh: &Shell, flags: flags::Publish) -> anyhow::Result<()> {
|
||||
no_plugins: false,
|
||||
plugins_only: true,
|
||||
no_web: false,
|
||||
args: vec![],
|
||||
},
|
||||
)
|
||||
.context(err_context)?;
|
||||
|
||||
@@ -17,6 +17,7 @@ pub fn test(sh: &Shell, flags: flags::Test) -> anyhow::Result<()> {
|
||||
no_plugins: false,
|
||||
plugins_only: true,
|
||||
no_web: flags.no_web,
|
||||
args: vec![],
|
||||
},
|
||||
)
|
||||
.context(err_context)?;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -52,7 +52,13 @@ fn validate_session(name: &str) -> Result<String, String> {
|
||||
}
|
||||
|
||||
#[derive(Parser, Default, Debug, Clone, Serialize, Deserialize)]
|
||||
#[clap(version, name = "zellij", styles = CLI_STYLES, args_override_self = true)]
|
||||
#[clap(
|
||||
version,
|
||||
name = "zellij",
|
||||
about = "A terminal workspace with batteries included",
|
||||
styles = CLI_STYLES,
|
||||
args_override_self = true
|
||||
)]
|
||||
pub struct CliArgs {
|
||||
/// Maximum panes on screen, caution: opening more panes will close old ones
|
||||
#[clap(long, value_parser)]
|
||||
|
||||
Reference in New Issue
Block a user