ansiparse

A package to read data and parse it into ANSI escape characters

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version 0.4.0
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-08-30 07:10

Authors

  • PMunch

Installation

nimble install ansiparse
choosenim install ansiparse
git clone https://github.com/PMunch/ansiparse

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
ansiparse - - - - - - -

Dependencies

Package Version Optional
nim >= 0.20.0 No

Source

Repository https://github.com/PMunch/ansiparse
Homepage https://github.com/PMunch/ansiparse
Registry Source nimble_official

README

ansiparse

This super small module is indented to correctly parse ANSI escape sequences to be then interpreted. Currently only Control Sequence Introducer sequnces are supported (these are the ones that are used for terminal colours and cursor movement). To parse a string with ANSI escape sequences in it, simply do

parseANSI("Hello \e[31;5mworld\e[m")

The parseANSI procedure takes a string and returns a sequence of variant objects that can either have kind == String and a str field with the string value, or a kind == CSI and have the parameter, intermediate, and final fields set to strings containing the valid values according to this: https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_sequences