Skip to content

Conversation

@pritamp19
Copy link

Reviewers

r? @
cc @stripe/developer-products

This commit addresses the TODO items identified in the samples functionality:

  • Add better naming for samples with display_name field
  • Implement grouping samples by product categories
  • Add comprehensive metadata (difficulty, language, tags)
  • Implement advanced filtering capabilities
  • Improve display formatting with visual hierarchy

Changes Made

Enhanced SampleData Structure

  • Added DisplayName, Category, Tags, Difficulty, and Language fields
  • Maintained backward compatibility with sensible defaults
  • All new fields are optional

New Helper Functions

  • GroupByCategory() - Groups samples by category
  • GetCategories() - Returns sorted category list
  • FilterByCategory() - Filters by category
  • FilterByTag() - Filters by tag
  • Safe getters with defaults for all metadata fields

Improved List Command

  • Added filtering flags (--category, --difficulty, --language, --tag)
  • Added compact display mode (--compact)
  • Enhanced help text and usage examples
  • Better error handling for filtered results

Visual Improvements

  • Category-based organization with emoji icons
  • Clear visual separation between groups
  • Metadata display when available
  • Summary statistics and helpful tips

Backward Compatibility

  • All existing functionality preserved
  • Original sample names work unchanged
  • New fields have sensible defaults
  • No breaking changes introduced

Testing

  • Comprehensive test coverage for all new functions
  • Edge case handling and default value testing
  • Filtering functionality validation

Files Modified

  • pkg/samples/list.go - Enhanced struct and helper functions
  • pkg/cmd/samples/list.go - Improved command with filtering
  • pkg/samples/list_test.go - Comprehensive test coverage

Closes #XXX (TODO items in samples functionality)

@pritamp19 pritamp19 requested a review from a team as a code owner September 16, 2025 05:37
@cla-assistant
Copy link

cla-assistant bot commented Sep 16, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@cla-assistant
Copy link

cla-assistant bot commented Sep 16, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant