Add lift and unlift commands for NSV line-level escaping#8
Merged
Conversation
Implement the line-level lift/unlift operations from the ENSV spec. lift applies NSV escape to each line; unlift applies unescape. These are inverses: unlift(lift(x)) == x for all inputs. Includes aliases (l/u) and a 25-case test suite covering roundtrips, edge cases, and existing NSV fixtures. https://claude.ai/code/session_01ETp6Za1KCCnFFsrvYQML4s
Transpose's 't' alias is justified by convention across table-handling frameworks and its longer name. Lift/unlift are short enough as-is, and single-letter aliases would conflict with future un- subcommands. https://claude.ai/code/session_01ETp6Za1KCCnFFsrvYQML4s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds two new commands to the NSV CLI tool:
liftandunlift. These commands apply NSV escaping/unescaping at the line level, allowing users to collapse or restore one structural dimension of NSV data.Key Changes
liftcommand (aliasl): Applies NSV escaping to each line, converting empty lines to backslash lines and escaping existing backslashesunliftcommand (aliasu): Applies NSV unescaping to each line, reversing the lift operationtests/test_lift_unlift.sh) with 20+ test cases covering:Implementation Details
nsv::escape_bytes()andnsv::unescape_bytes()functions from the NSV modulehttps://claude.ai/code/session_01ETp6Za1KCCnFFsrvYQML4s