erm/internal/app/darktile/cmd/fonts.go

31 lines
539 B
Go
Raw Normal View History

2021-07-30 22:29:20 +00:00
package cmd
import (
"fmt"
"github.com/liamg/fontinfo"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(listFontsCmd)
}
var listFontsCmd = &cobra.Command{
Use: "list-fonts",
Short: "List fonts on your system which are compatible with darktile",
SilenceUsage: true,
RunE: func(c *cobra.Command, args []string) error {
fonts, err := fontinfo.Match(fontinfo.MatchStyle("Regular"))
if err != nil {
return err
}
for _, font := range fonts {
fmt.Println(font.Family)
}
return nil
},
}