Skip to content
Myr

command.go

This file

Path

man/command.go

25 lines · 711 bytes · Go

Last changed by

fix: lint issues (#909)Carlos Alexandro Beckerbefore adoption817c4bd

History of this file

Take it

1// Package man the man command.2package man34import (5	"fmt"67	"github.com/alecthomas/kong"8	mangokong "github.com/alecthomas/mango-kong"9	"github.com/muesli/roff"10)1112// Man is a gum sub-command that generates man pages.13type Man struct{}1415// BeforeApply implements Kong BeforeApply hook.16func (m Man) BeforeApply(ctx *kong.Context) error {17	// Set the correct man pages description without color escape sequences.18	ctx.Model.Help = "A tool for glamorous shell scripts."19	man := mangokong.NewManPage(1, ctx.Model)20	man = man.WithSection("Copyright", "(c) 2022-2024 Charmbracelet, Inc.\n"+21		"Released under MIT license.")22	_, _ = fmt.Fprint(ctx.Stdout, man.Build(roff.NewDocument()))23	ctx.Exit(0)24	return nil25}