mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-26 01:34:43 +03:00
1ea24dac4a
* "sq diff" initial implementation * Refactor "cli" pkg.
37 lines
753 B
Go
37 lines
753 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/neilotoole/sq/cli/run"
|
|
|
|
mcobra "github.com/muesli/mango-cobra"
|
|
"github.com/muesli/roff"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newManCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "man",
|
|
Short: "Generate man pages",
|
|
SilenceUsage: true,
|
|
DisableFlagsInUseLine: true,
|
|
Hidden: true,
|
|
Args: cobra.NoArgs,
|
|
RunE: execGenerateMan,
|
|
}
|
|
|
|
return cmd
|
|
}
|
|
|
|
func execGenerateMan(cmd *cobra.Command, _ []string) error {
|
|
ru := run.FromContext(cmd.Context())
|
|
manPage, err := mcobra.NewManPage(1, cmd.Root())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
_, err = fmt.Fprint(ru.Out, manPage.Build(roff.NewDocument()))
|
|
return err
|
|
}
|