• Posts
  • RSS
  • ◂◂RSS
  • Contact

  • Introducing icdiff

    March 11th, 2009
    tech, icdiff  [html]
    The first time I used wikipedia to look at revisions I was quite impressed by the colored two column output indicating which bits had changed. Working mostly on the command line, it's been frustrating that diff can't do better than two column output. Even colored diff and cdiff only color lines by whether they're from the left or the right, not whether they're internally different. Python's difflib can create the wikipedia-style two column colored output, though, and with a bit of modification can print to the console with ansi escape sequences:
    jefftk@host ~ $ python icdiff.py text_A text_B
    This is an unchanged line This is an unchanged line
    This is a line with a speleing error This is a line with a spelling error
    This line was deleted
    Whitespace     shows up where critical Whitespace shows up where critical
    But it's not     shown when not But it's not ugly when not
    And here I go, adding a line
    And the usage:
      usage: icdiff.py [options] left_file right_file
    
      options:
        -h, --help           show this help message and exit
        --cols=COLS          specify the width of the screen. Autodetection is Linux
                             only
        --context            print only differences with some context
        --numlines=NUMLINES  how many lines of context to print; only meaningful
                             with --context
        --line-numbers       generate output with line numbers
        --show-all-spaces    color all non-matching whitespace instead of just
                             whitespace that is critical for understanding
        --print-headers      label the left and right sides with their file names
      
    Improved Color diff: icdiff

    Comment via: google plus, facebook

    Recent posts on blogs I like:

    The Limit of Circles in the Suburbs

    In dense urban cores, it’s valuable to run circular rail lines. They connect dense near-center neighborhoods to one another without going through the more congested center, and help make transferring between parallel lines more efficient, again through av…

    via Pedestrian Observations September 6, 2020

    Collections: Bread, How Did They Make It? Addendum: Rice!

    As an addendum on to our four-part look at the general structures of the farming of cereal grains (I, II, III, IV) this post is going to briefly discuss some of the key ways that the structures of rice farming differ from the structures of wheat and barle…

    via A Collection of Unmitigated Pedantry September 4, 2020

    Notes on “Anthropology of Childhood” by David Lancy

    I read David Lancy’s “The Anthropology of Childhood: Cherubs, Chattel, and Changelings” and highlighted some passages. A lot of passages, it turns out. [content note: discussion of abortion and infanticide, including infanticide of children with disabilit…

    via The whole sky August 27, 2020

    more     (via openring)


  • Posts
  • RSS
  • ◂◂RSS
  • Contact