### Setup Development Environment Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Commands to clone the repository, trust mise, and install the development environment. ```bash # Clone and enter directory git clone https://github.com/gurgeous/tennis.git cd tennis # Trust mise (one-time) mise trust # Install dev environment mise install # Verify Zig zig version # Should be 0.16.x ``` -------------------------------- ### .mise.toml Usage Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Example commands for using .mise.toml for development environment setup. ```bash mise trust # Enable mise in project mise install # Install tools zig build # Build with proper Zig version ``` -------------------------------- ### Test Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md An example of an inline test block in Zig. ```zig test "parse args accepts dash positional" { const out = try parseTest(&.{"-"}); defer out.deinit(testing.allocator); try testing.expectEqualStrings("-", out.filename.?); } ``` -------------------------------- ### Select Columns Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Example of using the --select option to show and reorder specific columns. ```bash # Show and reorder --select "name,score,date" # Result: Only these columns, in this order ``` -------------------------------- ### Example: Select Columns Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `--select` flag to choose and reorder specific columns. ```bash tennis data.csv --select "name,score,age" ``` -------------------------------- ### Install with Homebrew Source: https://github.com/gurgeous/tennis/blob/main/README.md Installation command for macOS users using Homebrew. ```sh #!/bin/sh $ brew install gurgeous/tap/tennis ``` -------------------------------- ### JSON Peek Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md An example of using the `--peek` option to quickly inspect JSON data piped from standard input. ```bash # Quick inspection without full formatting cat api_response.json | tennis --peek ``` -------------------------------- ### Example: Show First N Rows Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `--head` flag to display only the first N data rows. ```bash tennis data.csv --head 10 ``` -------------------------------- ### Styled Table Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md An example demonstrating how to add visual enhancements to the table output using various command-line options. ```bash # Add visual enhancements tennis data.csv \ --row-numbers \ --title "Sales Report" \ --border double \ --zebra \ --theme dark ``` -------------------------------- ### Width Configuration Examples Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Examples of using the --width option to control layout, including fixed width, header-only width, no truncation, and auto width based on terminal size. ```bash tennis data.csv --width 80 # Fixed 80 chars tennis data.csv --width min # Header width only tennis data.csv --width max # No truncation tennis data.csv --width auto # Terminal width (default) ``` -------------------------------- ### CI GitHub Actions Workflow Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Example of a GitHub Actions workflow for CI. ```yaml # .github/workflows/ci.yml # Runs on: Every push and pull request # Jobs: # 1. Run test suite (zig build test) # 2. Build release binary # 3. Format check (zig fmt) # 4. Lint and analysis (if configured) # Artifacts: Binary available for download ``` -------------------------------- ### Example: Use Pager Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `-p` or `--pager` flag to pipe output through a pager. ```bash tennis data.csv --pager ``` -------------------------------- ### Troubleshooting Zig Not Found Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Commands to install Zig if it's not found. ```bash mise install zig # Install via mise # or manually: https://ziglang.org/download ``` -------------------------------- ### Shell Command Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/README.md Example of a shell command using the Tennis CLI. ```bash tennis data.csv --option value ``` -------------------------------- ### Example: Sort Columns Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `--sort` flag to sort rows by specified columns. ```bash tennis data.csv --sort "score,name" ``` -------------------------------- ### Example: Enable Zebra Striping Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `--zebra` flag to enable alternating row colors. ```bash tennis data.csv --zebra ``` -------------------------------- ### Example: Shuffle Rows Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `--shuffle` or `--shuf` flag to randomize row order. ```bash tennis data.csv --shuffle ``` -------------------------------- ### Analysis and Sorting Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Example showing how to sort data by a specific column in descending order, display the top N rows, and format floating-point numbers. ```bash # Sort by amount descending, show top 20 tennis sales.csv \ --sort amount \ --reverse \ --head 20 \ --digits 2 ``` -------------------------------- ### Example: Enable Row Numbers Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `-n` or `--row-numbers` flag to display row numbers. ```bash tennis data.csv -n ``` -------------------------------- ### Head/Tail Behavior Examples Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Examples demonstrating the use of --head and --tail to display a specific number of data rows from the beginning or end of the file. ```bash # Data file has: header + 1000 rows tennis data.csv --head 10 # Shows header + 10 rows tennis data.csv --tail 10 # Shows header + 10 rows (last 10) ``` -------------------------------- ### Select the color theme Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of selecting a color theme with the --theme option. ```bash tennis data.csv --theme dark ``` -------------------------------- ### Manual Release Build Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Commands to manually build and install the release version of the project. ```bash # Build for current platform zig build -Doptimize=ReleaseFast install # Binary in: zig-out/bin/tennis ``` -------------------------------- ### Numeric Formatting Examples Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Examples of controlling numeric formatting with the --digits option for decimal places and the --vanilla option to disable formatting. ```bash # 2 decimal places for floats tennis sales.csv --digits 2 # Disable formatting entirely tennis data.csv --vanilla ``` -------------------------------- ### Filter and Inspect Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Example for filtering data based on a string pattern and using the `--peek` option for a quick look at the subset of data. ```bash # Quick look at subset tennis big_table.csv \ --filter "2024" \ --peek ``` -------------------------------- ### Column Selection Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Demonstrates how to reorder and select specific columns from a table, and enable the pager for viewing the output. ```bash # Reorder and select columns tennis full_table.csv \ --select "date,description,amount,notes" \ --pager ``` -------------------------------- ### CSV Parsing Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ALGORITHMS_AND_PATTERNS.md An example demonstrating the input CSV string and its parsed output, showing how quoted fields are handled. ```csv Input: alice,"Smith, Jr.",30 Parsed: ["alice", "Smith, Jr.", "30"] ``` -------------------------------- ### Deselect Columns Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Example of using the --deselect option to exclude specific columns. ```bash # Hide internal columns --deselect "internal_id,temp_field" # Result: All except these columns ``` -------------------------------- ### Delimiter Detection Algorithm Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ALGORITHMS_AND_PATTERNS.md An example illustrating the delimiter detection process, showing input data and the analysis of delimiter counts. ```text Input: name;age;city alice;30;NYC bob;25;LA Delimiter analysis: ; count: 2, 2, 2 ← Consistent, select , count: 0, 0, 0 \t count: 0, 0, 0 Result: ; (semicolon) ``` -------------------------------- ### Recommended Viewing Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/README.md Examples of how to view and search documentation files using command-line tools. ```bash # View in pager less CLI_REFERENCE.md # View with syntax highlight bat CLI_REFERENCE.md # Search within document grep -i "delimiter" CLI_REFERENCE.md ``` -------------------------------- ### Example: Peek Data Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `--peek` flag to display data shape and statistics instead of the full table. ```bash tennis data.csv --peek ``` -------------------------------- ### Example Bug Report Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ERROR_HANDLING.md An example of a bug report including command, error message, file sample, system info, and expected vs. actual behavior. ```bash Command: tennis sales.csv --digits 2 Error: Invalid CSV at row 15 File contents (first few rows): date,amount,description 2024-01-01,1234.56,sale 2024-01-02,"broken quote Expected: Display formatted table with 2 decimal places Actual: Error during parsing ``` -------------------------------- ### Example: Deselect Columns Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `--deselect` flag to exclude specific columns. ```bash tennis data.csv --deselect "internal_id,temp_field" ``` -------------------------------- ### Example: Set Border Style Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `--border` flag to change the table's border style. ```bash tennis data.csv --border double ``` -------------------------------- ### Table Initialization Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/MODULES.md Builds a table with all transforms applied, returning an allocated Table that needs to be deinitialized. ```zig init(app, config, data) ``` -------------------------------- ### Example: Add Table Title Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `-t` or `--title` flag to add a title to the displayed table. ```bash tennis data.csv --title "Sales Data" ``` -------------------------------- ### Standard Build Commands Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Common commands for building, testing, cleaning, and installing the Tennis project using the Zig build system. ```bash # Development build zig build # Release build (optimized) zig build -Doptimize=ReleaseFast # Install to system zig build install # Run tests zig build test # Clean build artifacts zig build clean ``` -------------------------------- ### Custom Width Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Examples of setting custom table widths. ```bash tennis data.csv --width 200 ``` ```bash tennis data.csv --width max ``` ```bash tennis data.csv --width min ``` -------------------------------- ### Example: Show Last N Rows Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `--tail` flag to display only the last N data rows. ```bash tennis data.csv --tail 5 ``` -------------------------------- ### SQLite Exploration Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Demonstrates how to explore a SQLite database table using Tennis, including sorting, limiting results, adding row numbers, and using a pager. ```bash # Browse database table with features tennis app.db \ --table users \ --sort "created_at" \ --reverse \ --head 50 \ --row-numbers \ --pager ``` -------------------------------- ### DataRow Initialization Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/MODULES.md Illustrates creating an owned row from a field slice, normalizing whitespace, and using a single buffer for all fields. ```zig DataRow.init(alloc, row_in) ``` -------------------------------- ### Show version number Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of showing the version number using the --version or -v flag. ```bash tennis --version ``` -------------------------------- ### Column Detection Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/MODULES.md Shows how to analyze all values in a column to determine its type and maximum display width. ```zig detect(alloc, rows, col) ``` -------------------------------- ### Example: Filter Rows Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `--filter` flag to display only rows matching a specific text string. ```bash tennis data.csv --filter "alice" ``` -------------------------------- ### Multi-column Sort Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Example of sorting by multiple columns, first by score descending, then by name ascending. Note that --reverse applies to the entire sort. ```bash # Sort by score (desc), then name (asc) --sort "score,name" --reverse # Note: --reverse reverses entire sort, not per-column ``` -------------------------------- ### Debugging with Print Statements Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Example of using Zig's debug print function. ```zig std.debug.print("Debug: {}\n", .{value}); ``` -------------------------------- ### Minimal Display Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md The simplest command to display data from a CSV file without any additional styling or options. ```bash # Simplest: just the data tennis data.csv ``` -------------------------------- ### Display help text Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of displaying help text using the --help or -h flag. ```bash tennis --help ``` -------------------------------- ### DataRow Projection Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/MODULES.md Demonstrates selecting a subset of columns from a DataRow by specifying the column order. ```zig DataRow.project(alloc, source, col_order) ``` -------------------------------- ### Manual Theme Override Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Examples of forcing the theme to light or dark using the --theme option. ```bash # Force light theme (dark text on light background) tennis data.csv --theme light # Force dark theme (bright text on dark background) tennis data.csv --theme dark ``` -------------------------------- ### Numeric Formatting Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of applying numeric formatting, sorting, and reversing order. ```bash tennis sales.csv --digits 2 --sort "amount" --reverse ``` -------------------------------- ### Benchmark large file Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Example of benchmarking with a large file using the BENCHMARK environment variable. ```bash # Benchmark large file BENCHMARK=1 tennis 1gb_file.csv --peek ``` -------------------------------- ### Generate shell completion script Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of generating a shell completion script for bash. ```bash tennis --completion bash > /usr/local/etc/bash_completion.d/tennis ``` -------------------------------- ### Natural Order Comparison Illustration Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/MODULES.md Illustrates the behavior of natural order comparison with examples. ```text "file2.txt" < "file10.txt" // 2 < 10 numerically "1.02" < "1.010" // 1.02 < 1.010 as fractions ``` -------------------------------- ### Terminal Width Detection Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ALGORITHMS_AND_PATTERNS.md Zig function demonstrating terminal width detection, querying the size once and caching it per table. ```zig pub fn termWidth(self: *Table) usize { if (self._term_width == null) { self._term_width = self.app.termWidth(); } return self._term_width.?; } ``` -------------------------------- ### JSON Data Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/README.md Example of JSON data format. ```json {"name": "alice", "score": 95} ``` -------------------------------- ### Building the Project Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Commands for building the project in development and release modes, and running the built application. ```bash # Dev build (fast, no optimizations) zig build # Release build (optimized) zig build -Doptimize=ReleaseFast # Run directly zig build run -- --help ``` -------------------------------- ### Column Width Caching Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ALGORITHMS_AND_PATTERNS.md Shows how column widths are calculated once and cached in a Layout struct for repeated use without recalculation. ```zig const layout = try Layout.init(table); // Use layout.widths[] repeatedly without recalculation ``` -------------------------------- ### Inline Tests Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ALGORITHMS_AND_PATTERNS.md Example of an inline test in Zig, demonstrating function call, resource deinitialization, and assertion. ```zig test "module: behavior" { const result = try function(args); defer result.deinit(allocator); try std.testing.expectEqual(expected, result); } ``` -------------------------------- ### Conflicting Options Command Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ERROR_HANDLING.md Example command to trigger a 'Conflicting Options' error. ```bash tennis data.csv --head 10 --tail 5 ``` -------------------------------- ### Single JSON Object Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/DATA_FORMATS.md Example of JSON data structured as a single object. ```json { "key1": "value1", "key2": "value2" } ``` -------------------------------- ### Tab-Separated Data Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Shows how to read tab-separated values (TSV) and sort the data by a specific column. ```bash # Read TSV, sort naturally tennis data.tsv \ --delimiter tab \ --sort "score" \ --reverse ``` -------------------------------- ### Natural Order Sorting Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ALGORITHMS_AND_PATTERNS.md Illustrates the difference between lexicographic and natural sorting, with a focus on numeric substrings. ```text Lexicographic: "1", "10", "2", "20" Natural: "1", "2", "10", "20" ✓ ``` -------------------------------- ### Array of Objects JSON Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/DATA_FORMATS.md Example of JSON data structured as an array of objects. ```json [ { "name": "alice", "score": 95 }, { "name": "bob", "score": 87 } ] ``` -------------------------------- ### Column Resolution with Case-Insensitive Matching Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Example demonstrating how --sort options accept comma-separated column names and perform case-insensitive matching. ```bash # Case-insensitive matching tennis data.csv --sort "Name, Score" # matches "name", "score" ``` -------------------------------- ### CSV Example Data Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/DATA_FORMATS.md An example of CSV data with quoted fields and escaped characters. ```csv name,age,score alice,30,95.5 bob,25,87.2 "Smith, Jane",28,92.0 ``` -------------------------------- ### Version Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md How the version is embedded at build time and accessed via the command line. ```zig const version = @import("build_options").version; ``` -------------------------------- ### Zig Language Code Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/README.md Example of Zig language code structure. ```zig pub fn example(input: []const u8) !Data ``` -------------------------------- ### CSV with Formatting Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of displaying a CSV file with various formatting options like row numbers, title, border, and zebra striping. ```bash tennis data.csv --row-numbers --title "Sales Report" --border double --zebra ``` -------------------------------- ### SQLite Table Not Found Command Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ERROR_HANDLING.md Example command to trigger a 'SQLite Table Not Found' error. ```bash tennis database.db --table invalid_table ``` -------------------------------- ### Select a specific table from a SQLite database Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the --table option to specify a table in a SQLite database. ```bash tennis data.db --table users ``` -------------------------------- ### Natural Sort Fraction Parsing Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ALGORITHMS_AND_PATTERNS.md Illustrates how Natural Sort uses fraction detection for efficient decimal comparison, avoiding full string parsing overhead. ```text "1.02" vs "1.010" → Parse as fractions, compare numerically → 1.02 (102/100) < 1.010 (1010/1000)? No ``` -------------------------------- ### Environment-Based Configuration Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Example of setting environment variables for configuration in shell scripts or CI/CD pipelines, including disabling color in CI. ```bash # In a shell script or CI/CD export PAGER=less export LESS= export NO_COLOR=${CI:-0} # Disable color in CI tennis data.csv --row-numbers --pager ``` -------------------------------- ### Natural Order Comparison Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/MODULES.md Compares two strings using natural order, where numeric strings are compared numerically and fractional parsing is supported. ```zig order(a, b, case_sensitive) ``` -------------------------------- ### JSONL (Newline-Delimited JSON) Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/DATA_FORMATS.md Example of JSON data structured as newline-delimited JSON objects. ```json {"name": "alice", "score": 95} {"name": "bob", "score": 87} ``` -------------------------------- ### Code Formatting Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Command to format the source code using zig fmt. ```bash zig fmt src/ ``` -------------------------------- ### Piped to Closed Output Command Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ERROR_HANDLING.md Example command demonstrating piping to a closed output (head), which tennis handles gracefully. ```bash tennis large.csv | head -10 ``` -------------------------------- ### Benchmark Mode Command Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Command to enable benchmark mode and capture output. ```bash BENCHMARK=1 zig build run -- data.csv 2>&1 | grep "benchmark" ``` -------------------------------- ### JSON Display Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Examples of displaying JSON files, including single JSON objects and JSON Lines format via pipe. ```bash tennis data.json ``` ```bash cat data.jsonl | tennis ``` -------------------------------- ### Running Tests Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Commands to run all tests or specific test modules. ```bash # Run all tests zig build test # Run specific test module zig build test -- src/args.zig ``` -------------------------------- ### JSON Parsing Error Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ERROR_HANDLING.md Shows an example of invalid JSON syntax causing a parsing error. ```json {"name": "alice", "age": 30 // missing } ``` -------------------------------- ### Testing Commands Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Commands for running tests, including verbose output and testing specific files. ```bash # Run all tests zig build test # Verbose test output zig build test -- --verbose # Test specific source file zig build test -- src/csv.zig ``` -------------------------------- ### Build Configuration Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md The main build function signature in build.zig. ```zig pub fn build(b: *std.Build) !void ``` -------------------------------- ### Build Options Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Standard Zig build options that can be used during the build process. ```bash # Cross-compile target -Dtarget=... # CPU features -Dcpu=... -Doptimize=Debug|ReleaseFast|ReleaseSmall|ReleaseSafe ``` -------------------------------- ### Filter Behavior Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Example of using the --filter option to display only rows where any cell contains the specified text (case-sensitive). ```bash # Find rows containing "alice" --filter "alice" # Returns rows where any column contains "alice" # Find rows with specific pattern --filter "2024-" ``` -------------------------------- ### .justfile Common Tasks Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Common development tasks defined in the .justfile using Just. ```bash just build # Build release binary just test # Run test suite just clean # Clean build artifacts just install # Install to system ``` -------------------------------- ### Example: Reverse Sort Order Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of using the `-r` or `--reverse` flag to reverse the row order, often used with `--sort`. ```bash tennis data.csv --sort "score" --reverse ``` -------------------------------- ### Unicode and Special Characters Example Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Example showing Tennis's ability to handle Unicode characters, including emoji, in table titles and content, and setting width to maximum. ```bash # Tennis handles emoji and special chars well tennis international_data.csv \ --title "Worldwide 🌍 Sales" \ --width max ``` -------------------------------- ### Build from source Source: https://github.com/gurgeous/tennis/blob/main/README.md Commands to build the project from source using mise and zig. ```sh #!/bin/sh $ mise trust && mise install $ zig build ``` -------------------------------- ### Sort and Filter Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of sorting and filtering a CSV file. ```bash tennis data.csv --sort "date,amount" --reverse --filter "2024" ``` -------------------------------- ### Column Selection Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of selecting specific columns from a CSV file and using a pager. ```bash tennis data.csv --select "name,email,phone" --pager ``` -------------------------------- ### Vendored Dependencies Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Indicates that the 'clap' library is vendored within the project for CLI argument parsing. ```zig Usage: Imported as `clap` in source files via Zig build system. ``` -------------------------------- ### Control color output Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of controlling color output with the --color option. ```bash tennis data.csv --color off ``` -------------------------------- ### Build fails on dependency Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Command to clear the cache and rebuild the project when facing dependency issues. ```bash rm -rf zig-cache/ zig build ``` -------------------------------- ### Wrong Delimiter Command Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ERROR_HANDLING.md Example command where the delimiter is not correctly specified for a tab-separated file. ```bash tennis data.tsv # Delimiter auto-detected as comma, but file is tab-separated ``` -------------------------------- ### Input Detection and Loading Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md Functions for detecting input format (CSV, JSON, SQLite) and loading data, with a note that SQLite cannot be read from stdin. ```zig fn load(app: *App, config: types.Config, input: std.Io.File) !Data ``` ```zig fn loadBytes(app: *App, config: types.Config, bytes_in: []const u8) !Data ``` -------------------------------- ### Windows Initialization Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/BUILD_AND_ENTRY.md A function to set the console output code page to UTF-8 on Windows for proper Unicode display. ```zig fn initWindows() void ``` -------------------------------- ### Quick Inspection Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CLI_REFERENCE.md Example of quickly inspecting a large CSV file using the --peek option. ```bash tennis large_file.csv --peek ``` -------------------------------- ### Enable Benchmarking Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/ERROR_HANDLING.md Command to enable benchmarking to identify slow stages in execution. ```bash BENCHMARK=1 tennis large.csv 2>&1 | grep "benchmark" ``` -------------------------------- ### Forced Color Options Source: https://github.com/gurgeous/tennis/blob/main/_autodocs/CONFIGURATION.md Examples of forcing color output on, off, or auto using the --color option. ```bash --color on # Always use color --color off # Never use color --color auto # Detect (default) ```