Skip to content

Add a typed list of tmux options (options-table.c) #160

Open

Description

@tony

Summary

libtmux names six tmux options and no others. OptionKey types a value, but the caller declares each key, so every other option is a string at the call site and only tmux knows its type, scope and values.

Motivation

A caller cannot ask the library which options exist, which scope each belongs to (server, session, window or pane), or what type its value has. Options.get(String) documents that an empty result means tmux does not know the option, so a misspelled name reads back as an option nobody set. A key declared with the wrong type fails only when the value is read, as a MalformedResponseException.

OptionKey records why it carries no catalogue: tmux adds options between releases and changes the type of a few, so a closed list would be wrong on some release. The six constants are the options whose type is the same on every supported release.

Sibling ports ship the list. libtmux-go generates option and hook definitions that carry each option's kind, scope and minimum tmux version, and libtmux-rs generates a schema of every option's name, kind and scope.

tmux declares each option with its type, scope and default in the options_table[] array of options-table.c, and records additions per release in CHANGES.

Proposal

A typed list of tmux options: each name the library knows, with its type.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions