A terminal client for Tangled.
0

Configure Feed

Select the types of activity you want to include in your feed.

nix/tg: add man page generation and set as default package

Aly Raffauf (Jul 18, 2026, 2:08 PM EDT) 02f52180 2d89afe5

+50 -4
+2
go.mod
··· 12 12 require ( 13 13 github.com/beorn7/perks v1.0.1 // indirect 14 14 github.com/cespare/xxhash/v2 v2.3.0 // indirect 15 + github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect 15 16 github.com/danieljoos/wincred v1.2.3 // indirect 16 17 github.com/earthboundkid/versioninfo/v2 v2.24.1 // indirect 17 18 github.com/fsnotify/fsnotify v1.10.1 // indirect ··· 41 42 github.com/prometheus/client_model v0.6.2 // indirect 42 43 github.com/prometheus/common v0.70.0 // indirect 43 44 github.com/prometheus/procfs v0.21.1 // indirect 45 + github.com/russross/blackfriday/v2 v2.1.0 // indirect 44 46 github.com/sagikazarmark/locafero v0.12.0 // indirect 45 47 github.com/spaolacci/murmur3 v1.1.0 // indirect 46 48 github.com/spf13/afero v1.15.0 // indirect
+3
go.sum
··· 5 5 github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= 6 6 github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 7 7 github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= 8 + github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= 9 + github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= 8 10 github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ= 9 11 github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs= 10 12 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= ··· 82 84 github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY= 83 85 github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= 84 86 github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= 87 + github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= 85 88 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 86 89 github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4= 87 90 github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
+5 -2
flake/packages.nix
··· 1 1 _: { 2 - perSystem = {pkgs, ...}: { 2 + perSystem = {pkgs, ...}: let 3 + tg = pkgs.callPackage ../nix/tg.nix {}; 4 + in { 3 5 packages = { 4 - tg = pkgs.callPackage ../nix/tg.nix {}; 6 + inherit tg; 7 + default = tg; 5 8 }; 6 9 }; 7 10 }
+7 -2
nix/tg.nix
··· 10 10 pname = "tg"; 11 11 version = "dev"; 12 12 src = ../.; 13 - vendorHash = "sha256-NKfVkBe863hXwjY1Jic+0rTnRD6v25pbzDx9W4W5OqU="; 13 + vendorHash = "sha256-vAjC3nyJvXVvsBj+JXPN7dNPAdhwY64lqHLsOhTuVKc="; 14 14 subPackages = ["cmd/tg"]; 15 - env.CGO_ENABLED = "0"; 16 15 17 16 nativeBuildInputs = [ 18 17 installShellFiles ··· 23 22 wrapProgram $out/bin/tg --prefix PATH : ${lib.makeBinPath [git]} 24 23 '' 25 24 + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 25 + # Man page dates stay reproducible because stdenv sets SOURCE_DATE_EPOCH, 26 + # which cobra/doc reads when GenManHeader.Date is unset. 27 + manPageDir=$(mktemp -d) 28 + $out/bin/tg man "$manPageDir" 29 + installManPage "$manPageDir"/* 30 + 26 31 installShellCompletion --cmd tg \ 27 32 --bash <($out/bin/tg completion bash) \ 28 33 --fish <($out/bin/tg completion fish) \
+32
internal/cli/man.go
··· 1 + package cli 2 + 3 + import ( 4 + "fmt" 5 + "os" 6 + 7 + "github.com/spf13/cobra" 8 + "github.com/spf13/cobra/doc" 9 + ) 10 + 11 + // manCmd is hidden from `tg --help`: it is a build-time tool the Nix 12 + // derivation invokes to generate man pages, not a user-facing command (cf. 13 + // `gh`, which produces man pages via its Makefile rather than a visible 14 + // subcommand). 15 + var manCmd = &cobra.Command{ 16 + Use: "man [directory]", 17 + Short: "Generate man pages", 18 + Args: cobra.ExactArgs(1), 19 + Hidden: true, 20 + RunE: func(_ *cobra.Command, args []string) error { 21 + dir := args[0] 22 + if err := os.MkdirAll(dir, 0o755); err != nil { 23 + return fmt.Errorf("create man page directory: %w", err) 24 + } 25 + header := &doc.GenManHeader{ 26 + Title: "tg", 27 + Section: "1", 28 + Source: "tg", 29 + } 30 + return doc.GenManTree(rootCmd, header, dir) 31 + }, 32 + }
+1
internal/cli/root.go
··· 93 93 94 94 rootCmd.AddCommand(browseCmd) 95 95 rootCmd.AddCommand(completionCmd) 96 + rootCmd.AddCommand(manCmd) 96 97 rootCmd.AddCommand(apiCmd) 97 98 }