History

Use --file-name flag to shorten displayed path (#198)

Sebastian Thiel committed 5 years ago

Commit 6e6dcda1 parent 4cc02133 files · +11 −4Browse files

Unified · Split

3 files
  1. cargo-smart-release/src/bat.rs +3 −2
  2. cargo-smart-release/src/command/changelog.rs +4 −1
  3. cargo-smart-release/src/command/release/manifest.rs +4 −1
cargo-smart-release/src/bat.rs+3−2
@@ -19,7 +19,7 @@ impl Support { · 18 unmodified lines
19 }19 }
20 }20 }
21 21
22 pub fn display_to_tty(&self, path: &Path) -> io::Result<()> {22 pub fn display_to_tty(&self, path: &Path, path_for_title: &Path) -> io::Result<()> {
23 if !self.bat.found {23 if !self.bat.found {
24 log::info!(24 log::info!(
25 "Would want to use 'bat' for colored preview of '{}', but it wasn't available in the PATH.",25 "Would want to use 'bat' for colored preview of '{}', but it wasn't available in the PATH.",
@@ -28,7 +28,8 @@ impl Support { · 2 unmodified lines
28 return Ok(());28 return Ok(());
29 }29 }
30 if Command::new("bat")30 if Command::new("bat")
31 .args(&["--paging=always", "-l=md"])31 .args(&["--paging=always", "-l=md", "--file-name"])
32 .arg(path_for_title)
32 .arg(path)33 .arg(path)
33 .status()?34 .status()?
34 .success()35 .success()
cargo-smart-release/src/command/changelog.rs+4−1
@@ -50,7 +50,10 @@ pub fn changelog(opts: Options, crates: Vec<String>) -> anyhow::Result<()> { · 49 unmodified lines
50 file.write_all(buf.as_bytes())50 file.write_all(buf.as_bytes())
51 })?;51 })?;
52 if let Some(bat) = bat.as_ref() {52 if let Some(bat) = bat.as_ref() {
53 bat.display_to_tty(lock.lock_path())?;53 bat.display_to_tty(
54 lock.lock_path(),
55 lock.resource_path().strip_prefix(&ctx.root.to_path_buf())?,
56 )?;
54 }57 }
55 if !opts.dry_run {58 if !opts.dry_run {
56 pending_changes.push(lock);59 pending_changes.push(lock);
cargo-smart-release/src/command/release/manifest.rs+4−1
@@ -239,7 +239,10 @@ pub(in crate::command::release_impl) fn edit_version_and_fixup_dependent_crates_ · 238 unmodified lines
239 .iter()239 .iter()
240 .filter(|(_, has_changes, _)| *has_changes)240 .filter(|(_, has_changes, _)| *has_changes)
241 {241 {
242 bat.display_to_tty(lock.lock_path())?;242 bat.display_to_tty(
243 lock.lock_path(),
244 lock.resource_path().strip_prefix(&ctx.base.root.to_path_buf())?,
245 )?;
243 }246 }
244 }247 }
245 248

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t