Function rg::args::hostname

source ·
fn hostname(bin: Option<&OsStr>) -> Option<String>
Expand description

Retrieves the hostname that ripgrep should use wherever a hostname is required. Currently, that’s just in the hyperlink format.

This works by first running the given binary program (if present and with no arguments) to get the hostname after trimming leading and trailing whitespace. If that fails for any reason, then it falls back to getting the hostname via platform specific means (e.g., gethostname on Unix).

The purpose of bin is to make it possible for end users to override how ripgrep determines the hostname.