### Run Bubble Table Demos and Examples Source: https://github.com/evertras/bubble-table/blob/main/README.md Provides commands to run various demonstrations and examples of the Bubble Table library. Includes commands for general demos, dimensions, and specific examples like pagination. ```Bash # Run the pokemon demo for a general feel of common useful features make # Run dimensions example to see multiple sizes of simple tables in action make example-dimensions # Or run any of them directly go run ./examples/pagination/main.go ``` -------------------------------- ### Run Tests Source: https://github.com/evertras/bubble-table/blob/main/CONTRIBUTING.md Execute the project's test suite. Ensure all tests pass before submitting changes. ```bash make test ``` -------------------------------- ### Run Linting Source: https://github.com/evertras/bubble-table/blob/main/CONTRIBUTING.md Execute the linting process for the project. This command checks for code style violations. ```bash make lint ``` -------------------------------- ### Define Table Columns and Rows in Go Source: https://github.com/evertras/bubble-table/blob/main/README.md Defines table columns with unique keys and creates rows with associated data. Demonstrates handling of missing columns and applying styles to rows and cells. ```Go const ( // This value isn't visible anywhere, so a simple lowercase is fine columnKeyID = "id" // It's just a string, so it can be whatever, really! They only must be unique columnKeyName = "何?!" ) // Note that there's nothing special about "ID" or "Name", these are completely // arbitrary columns columns := []table.Column{ table.NewColumn(columnKeyID, "ID", 5), table.NewColumn(columnKeyName, "Name", 10), } rows := []table.Row{ // This row contains both an ID and a name table.NewRow(table.RowData{ columnKeyID: "abc", columnKeyName: "Hello", }), table.NewRow(table.RowData{ columnKeyID: "123", columnKeyName: "Oh no", // This field exists in the row data but won't be visible "somethingelse": "Super bold!", }), table.NewRow(table.RowData{ columnKeyID: "def", // This row is missing the Name column, so it will use the supplied missing // indicator if supplied when creating the table using the following option: // .WithMissingDataIndicator("<ない>") (or .WithMissingDataIndicatorStyled!) }), // We can also apply styling to the row or to individual cells // This row has individual styling to make it bold table.NewRow(table.RowData{ columnKeyID: "bold", columnKeyName: "Bolded", }).WithStyle(lipgloss.NewStyle().Bold(true). , // This row also has individual styling to make it bold table.NewRow(table.RowData{ columnKeyID: "alert", // This cell has styling applied on top of the bold columnKeyName: table.NewStyledCell("Alert", lipgloss.NewStyle().Foreground(lipgloss.Color("#f88"))), }).WithStyle(lipgloss.NewStyle().Bold(true), } ``` -------------------------------- ### Format Code Source: https://github.com/evertras/bubble-table/blob/main/CONTRIBUTING.md Run the code formatting tool to ensure consistent code style. This command applies automatic formatting rules. ```bash make fmt ``` -------------------------------- ### Attach Metadata to Table Rows in Go Source: https://github.com/evertras/bubble-table/blob/main/README.md Demonstrates attaching hidden metadata to table rows, which is not displayed but remains accessible. Useful for referencing associated data objects when a row is selected. ```Go const ( columnKeyID = "id" columnKeyName = "名前" columnKeyUserData = "userstuff" ) // Notice there is no "userstuff" column, so it won't be displayed columns := []table.Column{ table.NewColumn(columnKeyID, "ID", 5), table.NewColumn(columnKeyName, "Name", 10), } // Just one user for this quick snippet, check the example for more user := &SomeUser{ ID: 3, Name: "Evertras", } rows := []table.Row{ // This row contains both an ID and a name table.NewRow(table.RowData{ columnKeyID: user.ID, columnKeyName: user.Name, // This isn't displayed, but it remains attached to the row columnKeyUserData: user, }), } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.