Skip to content

Conversation

@biasedbit
Copy link
Contributor

Optionally adds line numbers to each input file in the output file. Useful for tooling that consumes code and generates documentation with links to highlight certain portions (example highlight).

Line number padding is based on total number of lines in the file (none for files with < 10 lines).

Usage:

sandworm generate -n
sandworm generate --line-numbers

Example output:

================================================================================
FILE: cmd/sandworm/main.go
================================================================================
 1: // Package main is the main package for the sandworm CLI.
 2: package main
 3: 
 4: import (
 5: 	"os"
 6: 
 7: 	"github.com/holonoms/sandworm/internal/cli"
 8: )
 9: 
10: func main() {
11: 	if err := cli.NewRootCmd().Execute(); err != nil {
12: 		os.Exit(1)
13: 	}
14: }
15: 

@biasedbit biasedbit requested a review from fredoliveira July 18, 2025 06:29
@biasedbit biasedbit force-pushed the feat/line-numbers branch from ce4e3e5 to e6954fd Compare July 18, 2025 06:31
@biasedbit biasedbit merged commit c9195db into main Jul 18, 2025
1 check passed
@biasedbit biasedbit deleted the feat/line-numbers branch July 18, 2025 06:43
TWDickson pushed a commit to TWDickson/sandworm that referenced this pull request Jul 18, 2025
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.

2 participants