cmd

package
v0.1.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOutputFilename = ImageTypeName + ".png"
)
View Source
const ImageTypeName = "blank"

Variables

View Source
var ConfigCmd = &cobra.Command{
	Use:   "config",
	Short: "Print a blank config for the " + ImageTypeName + " image type",
	Run: func(cmd *cobra.Command, args []string) {
		encoded, _ := json.Marshal(pkg.Config{Color: "white"})
		cmd.Println(string(encoded))
	},
}
View Source
var GenerateCmd = &cobra.Command{
	Use:     "generate",
	Short:   "Generates a " + ImageTypeName + " image",
	PreRunE: parseConfig,
	RunE: func(cmd *cobra.Command, args []string) error {
		image := ImageGenerator.GenerateImage(viper.GetInt("width"), viper.GetInt("height"))

		if viper.GetBool("to-stdout") {
			return internal.EncodeImage(cmd.OutOrStdout(), image)
		} else {
			return internal.WriteImage(viper.GetString("output"), image)
		}
	},
}
View Source
var ImageGenerator pkg.ImageGenerator
View Source
var Version = "dev"
View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Print the version of this image source",
	Run: func(cmd *cobra.Command, args []string) {
		cmd.Printf("%s version: %s\n", ImageTypeName, Version)
	},
}

Functions

func Execute

func Execute()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL