1. 34

Some fun using ANSI escape sequences to modify the result of the git log command

  1.  

  2. 5

    Or: How to do crimes against VT100 emulation.

    From the UNIX Hater’s Handbook:

    Programmers at the revered Digital Equipment Corporation took a very simple-minded approach to solving the heterogenous terminal problem. Since their company manufactured both hardware and software, they simply didn’t support terminals made by any other manufacturer. They then hard-coded algorithms for displaying information on the standard DEC VT52 (then the VT100, VT102, an so on) into their VMS operating system, application programs, scripts, mail messages, and any other system string that they could get their hands on. Indeed, within DEC’s buildings ZK1, ZK2, and ZK3, an entire tradition of writing animated “christmas cards” and mailing them to other, unsuspecting users grew up around the holidays. (Think of these as early precursors to computer worms and viruses.)

    1. 4

      ^v<ESC> can also be used directly at a shell prompt, if you want to use git commit -m.

      1. 9

        I recommend a shell alias.

        alias blink='printf "^[[5m;%s^[0"'
        

        Or whatever it is that actually works. Then:

        git commit -a -m `blink "check yo self"`
        
      2. 4

        Why stop there, why not inject terminal escape sequences and change the background color or draw weird fonts on the person’s xterm…

        1. 1

          Seems like we could change the terminals title, clear the screen, change the position of the cursor… Basically take total control of what the terminal shows to the user.

        2. 2

          I’m going to assume you can disable this by telling git not to use less -R, but I’m not near my desk to experiment.

          1. 7

            But then you won’t get colors either! What’s wrong with you???

            1. 3

              mutter mutter good taste mutter

              1. 2

                No doubt.

                OT: Is there a way to make git diff more GitHub-like? I find it near-useless in its default state. Some 256-color magic, maybe?

                1. [Comment removed by author]

                  1. 3

                    Cool, thanks. Looks like that’s part of git core’s contrib since 2013, and there are other “word” options as well:

                    http://stackoverflow.com/questions/5326008/highlight-changed-lines-and-changed-bytes-in-each-changed-line

            2. 1

              brilliant.