ls tricks for git-annex?

martin f krafft madduck at madduck.net
Fri Sep 26 13:00:53 CEST 2014


also sprach Axel Beckert <abe at deuxchevaux.org> [2014-09-25 08:58 +0200]:
> direnv - Utility to set directory specific environment variables
> environment-modules - Modular system for handling environment variables
> envstore - save and restore environment variables

Yeah, I know about those and it's a possible usecase, except it
requires you to chdir() and the last time I tried these solutions,
they were brittle and could get messy. Setting variables on chdir()
is trivial to do. The problem has always been clearing the
environment when leaving the directory.

But direnv looks good and I will give it a try.

Does anyone have other ideas too?

What would be nice would be /bin/ls with a flag e.g.

  ls --dereference-if-reference-matches=*.git/annex/objects/* …

Unfortunately, I fear that we won't be able to get that (still:
#762922)…

Of course, I could do something along the lines of

  myls() {
    local usecolor; usecolor=never
    [ -t 1 ] && usecolor=always
    ls --color=$usecolor "$@" |
      while read line; do
        case "$line" in
          (*-\> *.git/annex/objects/*)
            echo "@${${line#l}% ->*}";;
          (*)
            echo "$line";;
        esac
      done
  }

but there is something in me that says it's a really bad idea to use
a pipe here, even if I could live with parsing the output of ls for
this cause.

-- 
@martinkrafft | http://madduck.net/ | http://two.sentenc.es/
 
"a human being should be able to change a diaper, plan an invasion,
 butcher a hog, conn a ship, design a building, write a sonnet,
 balance accounts, build a wall, set a bone, comfort the dying, take
 orders, give orders, cooperate, act alone, solve equations, analyze
 a new problem, pitch manure, program a computer, cook a tasty meal,
 fight efficiently, die gallantly. specialization is for insects."
                                                  -- robert heinlein
 
spamtraps: madduck.bogus at madduck.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: digital_signature_gpg.asc
Type: application/pgp-signature
Size: 1107 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)
URL: <http://lists.madduck.net/pipermail/vcs-home/attachments/20140926/137ed524/attachment.sig>


More information about the vcs-home mailing list