Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateBashCode(lines []string) string
- func GenerateGoCode(lines []string) string
- func GenerateJSCode(lines []string) string
- func GeneratePythonCode(lines []string) string
- func GenerateRustCode(lines []string) string
- func GenerateTXTCode(lines []string) string
- func SanitizeFilename(filename string) string
- type ExportFormat
- type ExportManager
- func (em *ExportManager) CheckFileExists(filename, formatName string) (bool, string, error)
- func (em *ExportManager) Export(content, filename, formatName string) error
- func (em *ExportManager) GetDefaultFormat() string
- func (em *ExportManager) GetFormatByName(name string) *ExportFormat
- func (em *ExportManager) GetFormatDescription(name string) string
- func (em *ExportManager) GetFormatExtension(name string) string
- func (em *ExportManager) GetFormatNames() []string
- func (em *ExportManager) GetSupportedFormats() []ExportFormat
Constants ¶
const MaxFilenameLength = 200
MaxFilenameLength is the maximum filename length before extension
Variables ¶
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 ¶
GenerateBashCode creates Bash script that reproduces the ANSI art
func GenerateGoCode ¶
GenerateGoCode creates Go source code that reproduces the ANSI art
func GenerateJSCode ¶
GenerateJSCode creates JavaScript source code that reproduces the ANSI art
func GeneratePythonCode ¶
GeneratePythonCode creates Python source code that reproduces the ANSI art
func GenerateRustCode ¶
GenerateRustCode creates Rust source code that reproduces the ANSI art
func GenerateTXTCode ¶
GenerateTXTCode creates plain text content by stripping ANSI codes
func SanitizeFilename ¶
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