Skip to content

Commit 5718c82

Browse files
dreamiurgclaude
andauthored
feat: add field parity and URLs to ascent show text output (#18)
Ensures complete field parity between JSON and plain text output for the `ascent show` command. All fields available in JSON are now displayed in the text format. Changes: - Add climber ID and URL to Climber field - Add peak URL to Peak field - Add ascent URL to Ascent ID field - Add "Has GPX" field (always shown) - Add "Has Trip Report" field with optional word count - Dim IDs in parentheses for better readability - Display all URLs inline with their respective entities All URLs are displayed on the same line as their identifiers, with IDs shown in dimmed gray for improved visual hierarchy. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent 05aac36 commit 5718c82

1 file changed

Lines changed: 26 additions & 4 deletions

File tree

peakbagger/formatters.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,21 @@ def format_ascent_detail(self, ascent: Ascent, output_format: str) -> None:
398398
table.add_column("Field", style="cyan", width=20, no_wrap=True)
399399
table.add_column("Value", style="white", no_wrap=True)
400400

401-
# Basic info
402-
table.add_row("Ascent ID", ascent.ascent_id)
403-
table.add_row("Climber", ascent.climber_name)
401+
# Basic info - Ascent ID with URL
402+
ascent_url = f"https://www.peakbagger.com/climber/ascent.aspx?aid={ascent.ascent_id}"
403+
ascent_id_display = (
404+
f"{ascent.ascent_id} [blue not underline]{ascent_url}[/blue not underline]"
405+
)
406+
table.add_row("Ascent ID", ascent_id_display)
407+
408+
# Climber info with ID and URL
409+
climber_display = ascent.climber_name
410+
if ascent.climber_id:
411+
climber_url = (
412+
f"https://www.peakbagger.com/climber/climber.aspx?cid={ascent.climber_id}"
413+
)
414+
climber_display += f" [dim]({ascent.climber_id})[/dim] [blue not underline]{climber_url}[/blue not underline]"
415+
table.add_row("Climber", climber_display)
404416

405417
if ascent.date:
406418
table.add_row("Date", ascent.date)
@@ -412,7 +424,8 @@ def format_ascent_detail(self, ascent: Ascent, output_format: str) -> None:
412424
if ascent.peak_name:
413425
peak_display = ascent.peak_name
414426
if ascent.peak_id:
415-
peak_display += f" ({ascent.peak_id})"
427+
peak_url = f"https://www.peakbagger.com/peak.aspx?pid={ascent.peak_id}"
428+
peak_display += f" [dim]({ascent.peak_id})[/dim] [blue not underline]{peak_url}[/blue not underline]"
416429
table.add_row("Peak", peak_display)
417430

418431
if ascent.location:
@@ -425,6 +438,9 @@ def format_ascent_detail(self, ascent: Ascent, output_format: str) -> None:
425438
if ascent.route:
426439
table.add_row("Route", ascent.route)
427440

441+
# Has GPX indicator (always show, even if false)
442+
table.add_row("Has GPX", "Yes" if ascent.has_gpx else "No")
443+
428444
# GPX metrics
429445
if ascent.elevation_gain_ft:
430446
table.add_row("Elevation Gain", f"{ascent.elevation_gain_ft:,} ft")
@@ -438,6 +454,12 @@ def format_ascent_detail(self, ascent: Ascent, output_format: str) -> None:
438454
dur_display = f"{hours}h {minutes}m" if minutes > 0 else f"{hours}h"
439455
table.add_row("Duration", dur_display)
440456

457+
# Trip report info
458+
has_tr_text = "Yes" if ascent.has_trip_report else "No"
459+
if ascent.trip_report_words:
460+
has_tr_text += f" ({ascent.trip_report_words:,} words)"
461+
table.add_row("Has Trip Report", has_tr_text)
462+
441463
self.console.print(table)
442464

443465
# Trip report section

0 commit comments

Comments
 (0)