_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
-
Description
Covers
-e NAME=valueon the commands that take it, the value argument ofset-environment,;-chained commands,{ ... }command blocks, and tmux command-string carriers such asif-shell,choose-tree,bind-key, andrun-shell -C. Only the logged copy goes through this; the argv tmux receives is unchanged.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 callsThe 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.