• Posts
  • RSS
  • ◂◂RSS
  • Contact

  • Introducing icdiff

    March 11th, 2009
    icdiff, tech
    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:

    A Big Problem With The Going To Bed Book

    One day my dad was reading this book called the "Going to Bed Book" to my sister Nora. The book is basically about a bunch of animals who are getting ready for bed on a boat. They go down the stairs, take a bath, hang their towels on the wall, find…

    via Lily Wise's Blog Posts September 18, 2023

    Investing in boundaries with young kids

    Putting in some work to get the behavior you want The post Investing in boundaries with young kids appeared first on Otherwise.

    via Otherwise August 15, 2023

    Self-driving car bets

    This month I lost a bunch of bets. Back in early 2016 I bet at even odds that self-driving ride sharing would be available in 10 US cities by July 2023. Then I made similar bets a dozen times because everyone disagreed with me. The first deployment to pot…

    via The sideways view July 29, 2023

    more     (via openring)


  • Posts
  • RSS
  • ◂◂RSS
  • Contact