Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

function libtmux-rs latest

option_schema

Look up what tmux declares about one option.

Source and package
Qualified name
libtmux::options::option_schema
Module
options
Package
libtmux
Source
crates/libtmux/src/options.rs
#[must_use] pub fn option_schema(name: &str) -> Option< &'static OptionSchema >

Description#

An option tmux does not declare, such as a user option beginning with @, returns None: it has no type beyond the text stored in it.

The name may carry an array index, as after-new-window[0] does, which is ignored for the lookup because every element of an array option shares one type.

Examples#

use libtmux::{OptionKind, option_schema};
// `status` looks like a flag but accepts on, off, and 2 through 5, so
// tmux declares it a choice. The schema records that rather than guessing.
assert_eq!(option_schema("status").map(|o| o.kind()), Some(OptionKind::Choice));
assert_eq!(option_schema("mouse").map(|o| o.kind()), Some(OptionKind::Flag));
assert_eq!(option_schema("history-limit").map(|o| o.kind()), Some(OptionKind::Number));
assert_eq!(option_schema("after-new-window[0]").map(|o| o.kind()), Some(OptionKind::Command));
assert_eq!(option_schema("@mine"), None);
Parameters
Esc

Type to search.

Reference previewOpen reference