cmd

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Copyright © 2024 Achno <EMAIL ADDRESS>

Copyright © 2025 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 Achnologia <EMAIL ADDRESS>

Copyright © 2024 Achno <EMAIL ADDRESS>

Copyright © 2025 Achno <EMAIL ADDRESS>

Copyright © 2024 Achnologia <EMAIL ADDRESS>

Copyright © 2024 Achnologia <EMAIL ADDRESS>

Copyright © 2024 Achnologia <EMAIL ADDRESS>

Copyright © 2025 Achno <EMAIL ADDRESS>

Copyright © 2024 Achno <EMAIL ADDRESS>

Copyright © 2024 Achnologia <EMAIL ADDRESS>

Copyright © 2024 Achno <EMAIL ADDRESS>

Index

Constants

This section is empty.

Variables

View Source
var BorderCmd = &cobra.Command{
	Use:   "border [PATH] [OPTIONAL OUTPUT]",
	Short: "draw a border with a specified  color and thickness on the image",
	PreRunE: func(cmd *cobra.Command, args []string) error {
		err := validateInput(shared, args)
		if err != nil {
			return err
		}
		return nil
	},
	Run: func(cmd *cobra.Command, args []string) {
		hex, err := cmd.Flags().GetString("color")
		utils.HandleError(err, "Error")

		clr, err := image.HexToRGBA(hex)
		utils.HandleError(err, "Error")

		processor := &image.BorderProcessor{
			Color:           clr,
			BorderThickness: BorderThickness,
		}

		imageOps, err := imageio.DetermineImageOperations(shared, args, cmd)
		utils.HandleError(err)

		logger.Print("Processing images...")

		processedImages, err := image.ProcessImgs(processor, imageOps, theme)
		utils.HandleError(err, "Error")

		if err != nil {
			logger.Error(err, "The following images had errors while processing")
		}

		openImageInViewer(shared, args, processedImages[0])
	},
}
View Source
var (
	BorderThickness int
)
View Source
var GridCmd = &cobra.Command{
	Use:   "grid [PATH] [OPTIONAL OUTPUT]",
	Short: "draw a grid with a specific size,color and thickness on the image",
	PreRunE: func(cmd *cobra.Command, args []string) error {
		err := validateInput(shared, args)
		if err != nil {
			return err
		}
		return nil
	},
	Run: func(cmd *cobra.Command, args []string) {
		imageOps, err := imageio.DetermineImageOperations(shared, args, cmd)
		utils.HandleError(err)
		logger.Print("Processing images...")

		processor := &image.GridProcessor{}
		processor.SetGridOptions(
			image.WithGridSize(gridSize),
			image.WithGridColor(gridColor),
			image.WithGridThickness(gridThickness),
			image.WithMaskonly(gridMask),
		)
		processedImages, err := image.ProcessImgs(processor, imageOps, theme)
		utils.HandleError(err, "Error")

		if err != nil {
			logger.Error(err, "The following images had errors while processing")
		}
		openImageInViewer(shared, args, processedImages[0])
	},
}
View Source
var ScaleFactor float64

Functions

func BuildCompressCmd added in v0.2.2

func BuildCompressCmd() *cobra.Command

func BuildOCRCmd added in v0.2.2

func BuildOCRCmd() *cobra.Command

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func LoadOCRConfig added in v0.2.2

func LoadOCRConfig(cmd *cobra.Command) (providers.Config, error)

(1) Loads default config (2) Merges the schema file if the schema flag is set and overrides the fields that are set (3) Overwrites the config with the flags if they are set

func RunCompressCmd added in v0.2.2

func RunCompressCmd(cmd *cobra.Command, args []string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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