Skip to main content

Module shell

Module shell 

Source
Expand description

Shell config block injection and path/value quoting.

BlockMarkers + the install_block_in_file / remove_block_from_file functions handle adding and removing managed blocks from .bashrc, .zshrc, SSH config, and similar files.

The quoting functions produce correctly-escaped strings for embedding paths and values into config files.

Structs§

BlockMarkers
Configuration for a managed block’s markers.

Enums§

BlockInstallResult
Result of an install/upsert operation.
BlockRemoveResult
Result of a removal operation.

Functions§

build_block
Build a complete block string from markers and body content.
find_block
Find the byte range of a managed block in the content.
has_block
Check whether a managed block is present.
install_block_in_file
Convenience: install or replace a managed block in a config file.
quote_config_value
Quote a value for embedding in a config file.
quote_credential_process_arg
Quote a path for the credential_process directive in AWS config.
quote_path_for_ssh_config
Quote a filesystem path for embedding in an SSH-style config file.
read_config_file
Read a file, normalize CRLF to LF, and return the content.
remove_block
Remove a managed block from the content.
remove_block_from_file
Convenience: remove a managed block from a config file.
upsert_block
Insert or replace a managed block in the content.
write_config_file
Write a config file, creating parent directories if needed.