Render an `ATOMIC_INSTALL=...` value suitable for embedding in a shell snippet. When the directory equals `$HOME/.local/bin` literally we keep the pretty `"$HOME/.local/bin"` form so users can copy it verbatim and have their shell expand `$HOME`. Otherwise we POSIX single-quote the absolute path so it survives copy-paste regardless of what's in it.
(dir: &Path, home: Option<&str>)
| 342 | /// single-quote the absolute path so it survives copy-paste regardless |
| 343 | /// of what's in it. |
| 344 | fn render_atomic_install_value(dir: &Path, home: Option<&str>) -> String { |
| 345 | if let Some(h) = home { |
| 346 | let home_local_bin = PathBuf::from(h).join(".local").join("bin"); |
| 347 | if dir == home_local_bin { |
| 348 | return r#""$HOME/.local/bin""#.to_string(); |
| 349 | } |
| 350 | } |
| 351 | shell_quote(&dir.display().to_string()) |
| 352 | } |
| 353 | |
| 354 | /// Produce the multi-line outdated message for a given source. Pure so |
| 355 | /// the unit tests can match on substrings. |