Skip to content

Commit

Permalink
Render nuspec as a relative path to the nugetize output
Browse files Browse the repository at this point in the history
This makes it easier to take screenshots without revealing full local paths, while still preserving the click-ability of those file links if the terminal supports it.
  • Loading branch information
kzu committed Feb 24, 2023
1 parent f821aee commit ed1106f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/dotnet-nugetize/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,18 @@ int Execute()

foundPackage = true;

var specFile = new FileInfo(metadata.Element("Nuspec").Value).FullName;
if (specFile.StartsWith(Directory.GetCurrentDirectory()))
specFile = specFile.Replace(Directory.GetCurrentDirectory(), "");
if (specFile.StartsWith(Path.DirectorySeparatorChar) || specFile.StartsWith(Path.AltDirectorySeparatorChar))
specFile = "." + specFile;

var grid = new Grid();
grid.AddColumn().AddColumn();
grid.AddRow(new Text("Package", yellow), new Grid().AddColumn()
.AddRow($"[yellow]{Path.GetFileName(metadata.Element("NuPkg").Value)}[/]")
.AddRow(new Text(metadata.Element("Nuspec").Value,
new Style(Color.Blue, decoration: Decoration.Underline, link: metadata.Element("Nuspec").Value))));
.AddRow(new Text(specFile,
new Style(Color.Blue, decoration: Decoration.Underline, link: specFile))));

root = new Tree(grid);

Expand Down

0 comments on commit ed1106f

Please sign in to comment.