annotate bin/edit @ 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 04a136d6150e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10308
520f4f114d5d <shachaf> fetch bin/edit http://slbkbs.org:5196/get?path=%2Fhackenv%2Fbin%2Fedit
HackBot
parents: 10307
diff changeset
1 #!/usr/bin/env python
520f4f114d5d <shachaf> fetch bin/edit http://slbkbs.org:5196/get?path=%2Fhackenv%2Fbin%2Fedit
HackBot
parents: 10307
diff changeset
2
10318
8c93629c5394 <fizzie> fetch bin/edit http://hackego.esolangs.org/get/bin/edit
HackBot
parents: 10308
diff changeset
3 import sys, os.path, re, urllib
10308
520f4f114d5d <shachaf> fetch bin/edit http://slbkbs.org:5196/get?path=%2Fhackenv%2Fbin%2Fedit
HackBot
parents: 10307
diff changeset
4
520f4f114d5d <shachaf> fetch bin/edit http://slbkbs.org:5196/get?path=%2Fhackenv%2Fbin%2Fedit
HackBot
parents: 10307
diff changeset
5 if len(sys.argv) < 2:
11494
04a136d6150e <fizzie> fetch bin/edit https://hack.esolangs.org/get/bin/edit
HackEso <hackeso@esolangs.org>
parents: 11241
diff changeset
6 sys.exit('https://hack.esolangs.org/edit/')
10308
520f4f114d5d <shachaf> fetch bin/edit http://slbkbs.org:5196/get?path=%2Fhackenv%2Fbin%2Fedit
HackBot
parents: 10307
diff changeset
7
10318
8c93629c5394 <fizzie> fetch bin/edit http://hackego.esolangs.org/get/bin/edit
HackBot
parents: 10308
diff changeset
8 f = os.path.realpath(sys.argv[1])
8c93629c5394 <fizzie> fetch bin/edit http://hackego.esolangs.org/get/bin/edit
HackBot
parents: 10308
diff changeset
9 f = re.sub(r"^/+hackenv/", "", f)
8c93629c5394 <fizzie> fetch bin/edit http://hackego.esolangs.org/get/bin/edit
HackBot
parents: 10308
diff changeset
10 if re.match(r"/|\.hg(?:/|ignore$|$)",f):
8c93629c5394 <fizzie> fetch bin/edit http://hackego.esolangs.org/get/bin/edit
HackBot
parents: 10308
diff changeset
11 sys.exit("File is not editable.")
11494
04a136d6150e <fizzie> fetch bin/edit https://hack.esolangs.org/get/bin/edit
HackEso <hackeso@esolangs.org>
parents: 11241
diff changeset
12 print 'https://hack.esolangs.org/edit/' + urllib.quote(f)