Skip to content

Commit

Permalink
remove v path segement
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Jul 27, 2024
1 parent 5c8e388 commit cee34a9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,13 @@ function textTable(rows: string[][], hsep = " "): string {
return ret;
}

function shortenGoName(moduleName: string) {
if (/\/v[0-9]$/.test(moduleName)) {
moduleName = dirname(moduleName);
}
return basename(moduleName);
}

function formatDeps(deps: DepsByMode) {
const arr = [["NAME", "OLD", "NEW", "AGE", "INFO"]];
const seen = new Set();
Expand All @@ -445,7 +452,7 @@ function formatDeps(deps: DepsByMode) {
if (seen.has(id)) continue;
seen.add(id);
arr.push([
mode === "go" ? basename(name) : name,
mode === "go" ? shortenGoName(name) : name,
highlightDiff(data.old, data.new, red),
highlightDiff(data.new, data.old, green),
data.age || "",
Expand Down

0 comments on commit cee34a9

Please sign in to comment.