export

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFilenameLength = 200

MaxFilenameLength is the maximum filename length before extension

Variables

View Source
var SupportedFormats = []ExportFormat{
	{
		Name:        "TXT",
		Extension:   ".txt",
		Description: "Plain text file",
	},
	{
		Name:        "GO",
		Extension:   ".go",
		Description: "Go source code",
	},
	{
		Name:        "JS",
		Extension:   ".js",
		Description: "JavaScript source code",
	},
	{
		Name:        "PY",
		Extension:   ".py",
		Description: "Python source code",
	},
	{
		Name:        "RS",
		Extension:   ".rs",
		Description: "Rust source code",
	},
	{
		Name:        "SH",
		Extension:   ".sh",
		Description: "Bash script",
	},
}

Available export formats

Functions

func GenerateBashCode

func GenerateBashCode(lines []string) string

GenerateBashCode creates Bash script that reproduces the ANSI art

func GenerateGoCode

func GenerateGoCode(lines []string) string

GenerateGoCode creates Go source code that reproduces the ANSI art

func GenerateJSCode

func GenerateJSCode(lines []string) string

GenerateJSCode creates JavaScript source code that reproduces the ANSI art

func GeneratePythonCode

func GeneratePythonCode(lines []string) string

GeneratePythonCode creates Python source code that reproduces the ANSI art

func GenerateRustCode

func GenerateRustCode(lines []string) string

GenerateRustCode creates Rust source code that reproduces the ANSI art

func GenerateTXTCode

func GenerateTXTCode(lines []string) string

GenerateTXTCode creates plain text content by stripping ANSI codes

func SanitizeFilename

func SanitizeFilename(filename string) string

SanitizeFilename removes dangerous characters from filenames

Types

type ExportFormat

type ExportFormat struct {
	Name        string // Canonical key (e.g., "TXT")
	Extension   string
	Description string
}

ExportFormat represents a supported export format

type ExportManager

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

ExportManager handles exporting text in various formats

func NewExportManager

func NewExportManager() *ExportManager

NewExportManager creates a new export manager with supported formats

func (*ExportManager) CheckFileExists

func (em *ExportManager) CheckFileExists(filename, formatName string) (bool, string, error)

CheckFileExists checks if a file already exists at the given path

func (*ExportManager) Export

func (em *ExportManager) Export(content, filename, formatName string) error

Export saves the content to a file in the specified format

func (*ExportManager) GetDefaultFormat

func (em *ExportManager) GetDefaultFormat() string

GetDefaultFormat returns the default export format (first in the list)

func (*ExportManager) GetFormatByName

func (em *ExportManager) GetFormatByName(name string) *ExportFormat

GetFormatByName returns the export format with the given name

func (*ExportManager) GetFormatDescription

func (em *ExportManager) GetFormatDescription(name string) string

GetFormatDescription returns the description for a given format name

func (*ExportManager) GetFormatExtension

func (em *ExportManager) GetFormatExtension(name string) string

GetFormatExtension returns the file extension for a given format name

func (*ExportManager) GetFormatNames

func (em *ExportManager) GetFormatNames() []string

GetFormatNames returns a slice of all format names in order

func (*ExportManager) GetSupportedFormats

func (em *ExportManager) GetSupportedFormats() []ExportFormat

GetSupportedFormats returns the list of supported export formats

Jump to

Keyboard shortcuts

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