mc

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package mc provides an output plugin for Midnight Commander (mc) skin themes.

MC skins use INI format with color specifications in the form:

foreground;background;attributes

where colors use xterm-256 color indices (colorN for N=0-255). This plugin uses the xterm256 template function from pkg/colour to convert tinct's hex RGB colors to the nearest xterm-256 index, skipping the first 16 system colors (0-15) for terminal independence.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEmbeddedTemplates

func GetEmbeddedTemplates() embed.FS

GetEmbeddedTemplates returns the embedded template filesystem. This is used by the template management commands.

Types

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin implements the output.Plugin interface for Midnight Commander.

func New

func New() *Plugin

New creates a new MC output plugin with default settings.

func (*Plugin) DefaultOutputDir

func (p *Plugin) DefaultOutputDir() string

DefaultOutputDir returns the default output directory for this plugin.

func (*Plugin) Description

func (p *Plugin) Description() string

Description returns the plugin description.

func (*Plugin) Generate

func (p *Plugin) Generate(themeData *colour.ThemeData) (map[string][]byte, error)

Generate creates the skin file. Returns map of filename -> content.

func (*Plugin) GetEmbeddedFS

func (p *Plugin) GetEmbeddedFS() any

GetEmbeddedFS returns the embedded template filesystem. Implements the output.TemplateProvider interface.

func (*Plugin) GetFlagHelp

func (p *Plugin) GetFlagHelp() []output.FlagHelp

GetFlagHelp returns help information for all plugin flags.

func (*Plugin) Name

func (p *Plugin) Name() string

Name returns the plugin name.

func (*Plugin) PostExecute

func (p *Plugin) PostExecute(_ context.Context, execCtx output.ExecutionContext, _ []string) error

PostExecute prints usage instructions after successful skin generation. Implements the output.PostExecuteHook interface.

func (*Plugin) PreExecute

func (p *Plugin) PreExecute(_ context.Context) (skip bool, reason string, err error)

PreExecute checks if mc is available before generating the skin. Implements the output.PreExecuteHook interface.

func (*Plugin) RegisterFlags

func (p *Plugin) RegisterFlags(cmd *cobra.Command)

RegisterFlags registers plugin-specific flags with the cobra command.

func (*Plugin) SetVerbose

func (p *Plugin) SetVerbose(verbose bool)

SetVerbose enables or disables verbose logging for the plugin. Implements the output.VerbosePlugin interface.

func (*Plugin) Validate

func (p *Plugin) Validate() error

Validate checks if the plugin configuration is valid.

func (*Plugin) Version

func (p *Plugin) Version() string

Version returns the plugin version.

Jump to

Keyboard shortcuts

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