Documentation
¶
Overview ¶
Package cmd implements the memelink CLI commands and Kong parser setup.
Index ¶
- func Execute(args []string) (err error)
- func ExitCode(err error) int
- func VersionString() string
- type CLI
- type ConfigCmd
- type ConfigGetCmd
- type ConfigListCmd
- type ConfigPathCmd
- type ConfigSetCmd
- type ConfigUnsetCmd
- type ExitError
- type FontsCmd
- type GenerateCmd
- type RootFlags
- type TemplatesCmd
- type VersionCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExitCode ¶
ExitCode extracts the exit code from an error. Returns 0 for nil, the embedded code for ExitError, 1 otherwise.
func VersionString ¶
func VersionString() string
VersionString returns a human-readable version string.
Types ¶
type CLI ¶
type CLI struct {
RootFlags `embed:""`
Version kong.VersionFlag `help:"Print version and exit"`
VersionCmd VersionCmd `cmd:"" name:"version" help:"Print version info"`
Generate GenerateCmd `cmd:"" name:"generate" aliases:"gen,g" default:"withargs" help:"Generate a meme"`
Templates TemplatesCmd `cmd:"" name:"templates" aliases:"ls" help:"List or view templates"`
Fonts FontsCmd `cmd:"" name:"fonts" help:"List or view fonts"`
Config ConfigCmd `cmd:"" name:"config" help:"Manage configuration"`
}
CLI is the top-level Kong command struct.
type ConfigCmd ¶
type ConfigCmd struct {
Path ConfigPathCmd `cmd:"" help:"Show config file path"`
List ConfigListCmd `cmd:"" help:"List all config values"`
Get ConfigGetCmd `cmd:"" help:"Get a config value"`
Set ConfigSetCmd `cmd:"" help:"Set a config value"`
Unset ConfigUnsetCmd `cmd:"" help:"Unset a config value"`
}
ConfigCmd groups configuration subcommands.
type ConfigGetCmd ¶
type ConfigGetCmd struct {
Key string `arg:"" help:"Config key to get"`
}
ConfigGetCmd gets a single config value.
type ConfigSetCmd ¶
type ConfigSetCmd struct {
Key string `arg:"" help:"Config key"`
Value string `arg:"" help:"Config value"`
}
ConfigSetCmd sets a config value.
type ConfigUnsetCmd ¶
type ConfigUnsetCmd struct {
Key string `arg:"" help:"Config key to unset"`
}
ConfigUnsetCmd removes a config value.
type FontsCmd ¶
type FontsCmd struct {
ID string `arg:"" optional:"" help:"Font ID for detail view"`
}
FontsCmd lists or views fonts.
type GenerateCmd ¶
type GenerateCmd struct {
// Positional: first is template ID or auto-generate text; rest are text lines.
Template string `arg:"" optional:"" help:"Template ID (omit for auto-generate, 'custom' for custom background)"`
Text []string `arg:"" optional:"" help:"Text lines for the meme"`
// Customization flags -- defaults empty; cascade fills from config/hardcoded.
Format string `help:"Image format (jpg,png,gif,webp)" short:"f"`
Font string `help:"Font ID or alias" name:"font"`
TextColor []string `help:"Text color per line (repeatable)" name:"text-color" sep:"none"`
Layout string `help:"Text layout (default,top)" name:"layout"`
Style []string `help:"Style name or overlay URL (repeatable)" name:"style" sep:"none"`
Width int `help:"Image width in pixels" name:"width"`
Height int `help:"Image height in pixels" name:"height"`
Center string `help:"Overlay center position (x,y)" name:"center"`
Scale string `help:"Overlay scale ratio" name:"scale"`
Safe bool `help:"Filter NSFW content" name:"safe"`
Background string `help:"Custom background image URL (use with 'custom' template)" name:"background"`
// Output action flags.
Copy bool `help:"Copy URL to clipboard" name:"copy" short:"c"`
Open bool `help:"Open URL in browser" name:"open" short:"o"`
Output string `help:"Download image to file path" name:"output"`
AutoOutput bool `help:"Download image to CWD with auto-generated name" short:"O"`
// Preview flag.
Preview *bool `help:"Show inline image preview" name:"preview" negatable:""`
}
GenerateCmd generates a meme. It is the default command when invoked with positional args (default:"withargs" in CLI struct).
type RootFlags ¶
type RootFlags struct {
Color string `help:"Color output: auto|always|never" default:"auto" enum:"auto,always,never"`
JSON bool `help:"JSON output" default:"false"`
Verbose bool `help:"Verbose logging" default:"false"`
NoInput bool `help:"Never prompt; fail instead" name:"no-input" default:"false"`
Force bool `help:"Skip confirmations" default:"false"`
}
RootFlags are global flags available to all commands.
type TemplatesCmd ¶
type TemplatesCmd struct {
ID string `arg:"" optional:"" help:"Template ID for detail view"`
Filter string `help:"Filter templates by name/keyword" name:"filter"`
Animated bool `help:"Show only animated-capable templates" name:"animated"`
Refresh bool `help:"Force cache refresh" name:"refresh"`
}
TemplatesCmd lists or views meme templates.