Mercurial > repo
annotate bin/url @ 12092:ceb43c4d37de draft
<fizzie> ` for w in benvenuto bienvenido bienvenue bonvenon tervetuloa v\xc3\xa4lkommen velkomin velkommen welcome welkom wercome willkommen \xd0\xb4\xd0\xbe\xd0\xb1\xd1\x80\xd0\xbe-\xd0\xbf\xd0\xbe\xd0\xb6\xd0\xb0\xd0\xbb\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x82\xd1\x8c; do sed -i -e \'2s|^|my $bin = $ENV{"HACKENV"}."/bin"; |;s|bin/[@?]|$&|g\' /hackenv/bin/$w; done
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Sat, 16 Nov 2019 22:19:36 +0000 |
parents | ff752d36eb0e |
children |
rev | line source |
---|---|
9075 | 1 #!/usr/bin/env python |
2 import sys, os.path, re, urllib | |
3 if len(sys.argv) <= 1: | |
11467
380e297c7ae5
<fizzie> sled bin/url//s,hackego.esolangs.org/fshg,hack.esolangs.org/repo,g;s,/index\\.cgi,,
HackEso <hackeso@esolangs.org>
parents:
10391
diff
changeset
|
4 print "https://hack.esolangs.org/repo/" |
9075 | 5 else: |
6 f = os.path.abspath(sys.argv[1]) | |
7 f = re.sub(r"^/+hackenv/", "", f) | |
10283 | 8 if re.match(r"/|\.hg(?:/|$)",f): |
9075 | 9 sys.exit("File is outside web-viewable filesystem repository.") |
10281 | 10 elif re.match(r"tmp(?:/|$)",f): |
11468
ff752d36eb0e
<fizzie> sled bin/url//s,https://hackego.esolangs.org/,https://hack.esolangs.org/,
HackEso <hackeso@esolangs.org>
parents:
11467
diff
changeset
|
11 print ("https://hack.esolangs.org/" + urllib.quote(f)) |
9075 | 12 else: |
11467
380e297c7ae5
<fizzie> sled bin/url//s,hackego.esolangs.org/fshg,hack.esolangs.org/repo,g;s,/index\\.cgi,,
HackEso <hackeso@esolangs.org>
parents:
10391
diff
changeset
|
13 print ("https://hack.esolangs.org/repo/file/tip/" + |
9075 | 14 urllib.quote(f)) |