Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,10 @@ jobs:
exit 1
fi

if ! grep -q "v(uutils coreutils) $VERSION" docs/src/utils/ls.md; then
echo "Version '$VERSION' not found in docs/src/utils/ls.md"
echo "Found version info:"
grep "v(uutils coreutils)" docs/src/utils/ls.md || echo "No version info found"
if ! grep -q "<div class=\"version\">v$VERSION</div>" docs/src/utils/ls.md; then
echo "Expected '<div class=\"version\">v$VERSION</div>' not found in docs/src/utils/ls.md"
echo "Full version section:"
grep -A2 -B2 "version" docs/src/utils/ls.md || echo "No version section found"
grep -C 2 "version" docs/src/utils/ls.md || echo "No version section found"
exit 1
fi

Expand Down
18 changes: 11 additions & 7 deletions src/bin/uudoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,18 @@ impl MDWriter<'_, '_> {

/// # Errors
/// Returns an error if the writer fails.
/// # Panics
/// Panics if the version is not found.
fn version(&mut self) -> io::Result<()> {
writeln!(
self.w,
"<div class=\"version\">v{}</div>",
self.command.render_version().split_once(' ').unwrap().1
)
let full_version_string = self.command.render_version();

// clap renders the version as "<name> (uutils coreutils) <version>",
// e.g. "b2sum (uutils coreutils) 0.3.0". Keep only the version number,
// which is the last whitespace-separated token.
let version_only = full_version_string
.split_whitespace()
.last()
.unwrap_or(&full_version_string);

writeln!(self.w, "<div class=\"version\">v{version_only}</div>")
}

/// # Errors
Expand Down