technote:markdown_reports
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| technote:markdown_reports [2026/09/18 01:16] – [Example Environment] Scott Cunliffe | technote:markdown_reports [2026/09/18 01:21] (current) – [References] Scott Cunliffe | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| ===== Overview ===== | ===== Overview ===== | ||
| - | [[https://github.com/charmbracelet/ | + | TapeTrack provides command-line utilities that can be used for reporting and task automation. The TapeTrack documentation identifies these utilities as a separate component of the TapeTrack system and provides a Command Line Utility reference. |
| - | Glow is useful when working with TapeTrack | + | TapeTrack |
| - | Glow can also browse Markdown files in a directory and provides a terminal user interface (TUI) for reading documents. | + | This can be useful when the output is intended to be: |
| - | ===== Installation ===== | + | * Saved as a Markdown file |
| + | * Viewed with a Markdown renderer such as Glow | ||
| + | * Included in documentation | ||
| + | * Compared with another generated report | ||
| + | * Processed as part of an automated reporting workflow | ||
| - | ==== Windows | + | ===== Setting the Report Format ===== |
| - | Glow can be installed on Windows using Windows Package Manager (WinGet). | + | Set the following environment variable before running the TapeTrack utility: |
| - | Open PowerShell and run: | + | < |
| - | + | set TMSSREPORTFORMAT=MARKDOWN | |
| - | < | + | |
| - | winget install charmbracelet.glow | + | |
| </ | </ | ||
| - | After installation, | + | The variable instructs |
| - | Verify the installation: | + | ==== Windows Command Prompt ==== |
| - | < | + | For a temporary setting within the current command session: |
| - | glow --version | + | |
| + | < | ||
| + | set TMSSREPORTFORMAT=MARKDOWN | ||
| </ | </ | ||
| - | ==== Example ==== | + | The setting applies to commands run from that command session. |
| - | A successful installation will report the installed Glow version. | + | ==== Batch File ===== |
| - | < | + | When using a Windows batch file, the following form can be used: |
| - | Glow v3.0.0 | + | |
| - | </ | + | |
| - | The exact version may change as newer releases become available. | + | <code batch> |
| + | @echo off | ||
| + | set " | ||
| - | ===== Basic Use ===== | + | TMSS10Inventory |
| + | </ | ||
| - | Change to the directory containing | + | Using the quoted '' |
| - | <code powershell> | + | ===== Writing Utility Output to a Markdown |
| - | cd " | + | |
| - | </ | + | |
| - | Display | + | Standard output can be redirected to a Markdown |
| - | < | + | For example: |
| - | glow .\Inventory_one.md | + | |
| + | < | ||
| + | TMSS10Inventory > out.md | ||
| </ | </ | ||
| - | A second | + | The result is a Markdown |
| - | < | + | < |
| - | glow .\Inventory_two.md | + | out.md |
| </ | </ | ||
| - | Glow does not modify the Markdown | + | The original command-line output is therefore retained as a file that can be viewed or processed independently. |
| - | ===== Rendering Styles | + | ===== Capturing Standard Error ===== |
| - | Glow supports terminal rendering styles. The standard styles include '' | + | Standard error can be redirected separately from the report output. |
| - | To explicitly use the dark style: | + | For example: |
| - | < | + | < |
| - | glow -s dark .\Inventory_one.md | + | TMSS10Inventory > out.md 2> err.txt |
| </ | </ | ||
| - | To use the light style: | + | This creates: |
| - | < | + | < |
| - | glow -s light .\Inventory_one.md | + | out.md |
| + | err.txt | ||
| </ | </ | ||
| - | The style affects the appearance of the rendered | + | The Markdown |
| - | ===== Word Wrapping ===== | + | This separation is useful when validating automated report generation because the report itself can remain clean Markdown while diagnostic or error output is retained separately. |
| - | Reports containing wide tables may benefit from specifying the terminal width. | + | ===== Complete Example ===== |
| - | For example: | + | A simple batch file can therefore be: |
| - | < | + | < |
| - | glow -s dark -w 120 .\Inventory_one.md | + | @echo off |
| + | set " | ||
| + | |||
| + | TMSS10Inventory > out.md 2> err.txt | ||
| </ | </ | ||
| - | The '' | + | The processing flow is: |
| - | + | ||
| - | ===== Interactive Mode ===== | + | |
| - | + | ||
| - | Running Glow without a file argument starts its terminal user interface: | + | |
| - | < | + | < |
| - | glow | + | TMSS10Inventory |
| + | | | ||
| + | +---- standard output ----> out.md | ||
| + | | | ||
| + | +---- standard error -----> err.txt | ||
| </ | </ | ||
| - | Glow searches the current directory and subdirectories for Markdown files and allows them to be browsed from the terminal. | + | ===== Generating Multiple Reports ===== |
| - | ===== Paging ===== | + | When two reports are generated at different times, they can be saved separately. |
| - | Glow can use a pager when displaying Markdown: | + | For example: |
| - | < | + | < |
| - | glow -p .\Inventory_one.md | + | @echo off |
| + | set " | ||
| + | |||
| + | TMSS10Inventory > out.md 2> err.txt | ||
| </ | </ | ||
| - | This is useful for reports that are longer than the visible terminal window. | + | A subsequent execution can save the second report as: |
| - | ===== Reading Markdown from Standard Input ===== | + | <code batch> |
| + | @echo off | ||
| + | set " | ||
| - | Glow can also receive Markdown through standard input. | + | TMSS10Inventory > out2.md 2> err2.txt |
| + | </ | ||
| - | For example: | + | The directory may then contain: |
| - | < | + | < |
| - | Get-Content | + | out.md |
| + | out2.md | ||
| + | err.txt | ||
| + | err2.txt | ||
| </ | </ | ||
| - | The '' | + | ===== Viewing |
| - | ===== Configuration ===== | + | Once the report has been generated, it can be displayed using Glow. |
| - | + | ||
| - | Glow provides a configuration facility: | + | |
| <code powershell> | <code powershell> | ||
| - | glow config | + | glow .\out.md |
| </ | </ | ||
| - | The configuration | + | A specific Glow style can be selected: |
| - | ===== Testing Glow with a TapeTrack Report ===== | + | <code powershell> |
| + | glow -s dark .\out.md | ||
| + | </ | ||
| - | First confirm the reports exist: | + | For a wide TapeTrack inventory table: |
| <code powershell> | <code powershell> | ||
| - | dir .\*.md | + | glow -s dark -w 120 .\out.md |
| </ | </ | ||
| - | Then render the report: | + | The second |
| <code powershell> | <code powershell> | ||
| - | glow -s dark .\Inventory_one.md | + | glow -s dark -w 120 .\out2.md |
| </ | </ | ||
| - | A Markdown table produced by a TapeTrack utility should be rendered as a formatted | + | Glow provides |
| - | ===== Glow and Report | + | ===== Example TapeTrack Inventory |
| - | Glow is a Markdown | + | A Markdown |
| - | + | ||
| - | For example, if the following files exist: | + | |
| < | < | ||
| - | Inventory_one.md | + | | Seq. | Barcode | Location | Repository | Expiry | Next Move | Last Move | GDup | CDup | Container | |
| - | Inventory_two.md | + | | ---: | --- | --- | --- | --- | --- | --- | ---: | ---: | --- | |
| + | | 1 | US02.LTO.0001 | Red 11 [1.12] | Offsite Vault [12] | Permanent | Permanent | 2026-09-08 13:14:04 | 6 | 1 | | | ||
| </ | </ | ||
| - | Glow can render each report: | + | Glow renders the Markdown table in a terminal-friendly format. |
| - | <code powershell> | + | ===== Comparing Two Generated Reports ===== |
| - | glow -s dark .\Inventory_one.md | + | |
| - | glow -s dark .\Inventory_two.md | + | |
| - | </ | + | |
| - | A separate comparison tool should | + | When two Markdown reports have been generated, PowerShell can be used to compare their contents. |
| - | For a simple PowerShell | + | A basic line comparison |
| <code powershell> | <code powershell> | ||
| - | Compare-Object (Get-Content .\Inventory_one.md) (Get-Content .\Inventory_two.md) | + | Compare-Object (Get-Content .\out.md) (Get-Content .\out2.md) |
| </ | </ | ||
| - | ===== Highlighting Changed Lines ===== | + | For reports where records remain in the same order, changed lines can be highlighted |
| - | + | ||
| - | PowerShell | + | |
| - | + | ||
| - | The following example colours changed lines red: | + | |
| <code powershell> | <code powershell> | ||
| - | $a = Get-Content .\Inventory_one.md | + | $a = Get-Content .\out.md |
| - | $b = Get-Content .\Inventory_two.md | + | $b = Get-Content .\out2.md |
| $max = [Math]:: | $max = [Math]:: | ||
| Line 200: | Line 210: | ||
| ``` | ``` | ||
| - | } </ | + | } |
| + | </ | ||
| - | This is a PowerShell comparison | + | This example displays the contents of '' |
| - | For reports where rows remain in the same order, | + | This comparison method is intended for reports where the line order is consistent. For inventory reports where records can move position, a comparison based on a unique field such as Barcode is more robust. |
| - | For production comparison of inventory reports, comparing records by Barcode rather than simply comparing line positions is preferable if rows may be added, removed or reordered. | + | ===== Example Workflow ===== |
| - | ===== Example Environment ===== | + | A practical workflow for generating, rendering and comparing TapeTrack Markdown reports is: |
| - | + | ||
| - | An example working directory may contain: | + | |
| < | < | ||
| - | Markdown\ | + | 1. Set TMSSREPORTFORMAT=MARKDOWN |
| - | Inventory_one.md | + | | |
| - | | + | v |
| - | | + | 2. Run TMSS10Inventory |
| - | | + | | |
| - | | + | +---- stdout ----> out.md |
| + | | | ||
| + | +---- stderr | ||
| + | | | ||
| + | v | ||
| + | 3. Render with Glow | ||
| + | | | ||
| + | v | ||
| + | 4. Generate a second report | ||
| + | | | ||
| + | v | ||
| + | 5. Render out2.md with Glow | ||
| + | | | ||
| + | v | ||
| + | 6. Compare out.md and out2.md | ||
| </ | </ | ||
| - | The Markdown reports can then be viewed with: | + | Example commands: |
| <code powershell> | <code powershell> | ||
| - | glow -s dark .\Inventory_one.md | + | set " |
| - | glow -s dark .\Inventory_two.md | + | |
| + | TMSS10Inventory > out.md 2> err.txt | ||
| + | |||
| + | glow -s dark -w 120 .\out.md | ||
| </ | </ | ||
| + | |||
| + | After generating a second report: | ||
| + | |||
| + | <code powershell> | ||
| + | glow -s dark -w 120 .\out2.md | ||
| + | |||
| + | Compare-Object (Get-Content .\out.md) (Get-Content .\out2.md) | ||
| + | </ | ||
| + | |||
| + | ===== Validation ===== | ||
| + | |||
| + | After setting up Markdown report generation, verify the following: | ||
| + | |||
| + | * The '' | ||
| + | * The TapeTrack utility completes normally. | ||
| + | * The standard output file contains Markdown. | ||
| + | * The report can be opened with Glow. | ||
| + | * The Markdown table is rendered correctly. | ||
| + | * Standard error is captured separately when required. | ||
| + | * A second report can be generated without overwriting the first report. | ||
| + | * Differences between reports can be identified using a comparison tool. | ||
| + | |||
| + | ===== Troubleshooting ===== | ||
| + | |||
| + | ==== Markdown file is empty ==== | ||
| + | |||
| + | Check that the TapeTrack utility produced output and that the command is being executed from the expected environment. | ||
| + | |||
| + | Check the error output: | ||
| + | |||
| + | <code powershell> | ||
| + | Get-Content .\err.txt | ||
| + | </ | ||
| + | |||
| + | ==== Glow is not recognised ==== | ||
| + | |||
| + | If Glow has just been installed using WinGet, close and reopen PowerShell so that the updated PATH is loaded. | ||
| + | |||
| + | Verify: | ||
| + | |||
| + | <code powershell> | ||
| + | glow --version | ||
| + | </ | ||
| + | |||
| + | ==== The Markdown table is difficult to read ==== | ||
| + | |||
| + | Specify a wider rendering width: | ||
| + | |||
| + | <code powershell> | ||
| + | glow -s dark -w 120 .\out.md | ||
| + | </ | ||
| + | |||
| + | ==== Differences appear on many lines ==== | ||
| + | |||
| + | The simple PowerShell comparison compares corresponding line positions. If records have been inserted, deleted or reordered, many lines may appear different. | ||
| + | |||
| + | For TapeTrack inventory reports, compare records using the Barcode field when a record-level comparison is required. | ||
| ===== References ===== | ===== References ===== | ||
| - | * [[https:// | + | * [[https:// |
| + | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | |||
| + | |||
| + | {{tag> technote markdown glow}} | ||
technote/markdown_reports.1789694200.txt.gz · Last modified: 2026/09/18 01:16 by Scott Cunliffe
