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.

MoreLess about this notice

function libtmux

_redact_env_values

Return argv with environment values masked and their names kept.

Source and package
Qualified name
libtmux._internal.log_context._redact_env_values
Module
libtmux._internal.log_context
Package
libtmux
Source
src/libtmux/_internal/log_context.py
_redact_env_values (argv: Sequence[str]) → list[str]

Description

Covers -e NAME=value on the commands that take it, the value argument of set-environment, ;-chained commands, { ... } command blocks, and tmux command-string carriers such as if-shell, choose-tree, bind-key, and run-shell -C. Only the logged copy goes through this; the argv tmux receives is unchanged.

Parameters

Examples

>>> _redact_env_values(["tmux", "new-window", "-deTOKEN=hunter2"])
['tmux', 'new-window', '-deTOKEN=***']
>>> _redact_env_values(["tmux", "splitw", "-e", "TOKEN=hunter2"])
['tmux', 'splitw', '-e', 'TOKEN=***']
>>> _redact_env_values(["tmux", "setenv", "-t", "$0", "--", "-dash", "hunter2"])
['tmux', 'setenv', '-t', '$0', '--', '-dash', '***']
>>> _redact_env_values(
... ["tmux", "set-option", "-q", "@x", "1", ";", "new-window", "-eK=v"]
... )
['tmux', 'set-option', '-q', '@x', '1', ';', 'new-window', '-eK=***']
>>> _redact_env_values(["tmux", "if-shell", "-F", "1", "new-window -eK=v"])
['tmux', 'if-shell', '-F', '1', "new-window '-eK=***'"]
>>> _redact_env_values(
... ["tmux", "bind-key", "C-b", "{", "new-window", "-e", "K=v", "}"]
... )
['tmux', 'bind-key', 'C-b', '{', 'new-window', '-e', 'K=***', '}']

A flag that is not an environment assignment is left alone:

>>> _redact_env_values(["tmux", "capture-pane", "-e", "-p"])
['tmux', 'capture-pane', '-e', '-p']

Recorded calls

source calls
No call edges in the Python model.

The Python reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls libtmux._internal.log_context._redact_env_values.

Esc
Search in

Type to search.

Reference previewOpen reference