comparison bin/edit @ 11494:04a136d6150e draft

<fizzie> fetch bin/edit https://hack.esolangs.org/get/bin/edit
author HackEso <hackeso@esolangs.org>
date Thu, 12 Apr 2018 10:57:14 +0100
parents c54ea57faa7a
children
comparison
equal deleted inserted replaced
11493:5e27018ad3a9 11494:04a136d6150e
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 import sys, os.path, re, urllib 3 import sys, os.path, re, urllib
4 4
5 if len(sys.argv) < 2: 5 if len(sys.argv) < 2:
6 sys.exit('https://hackego.esolangs.org/edit/') 6 sys.exit('https://hack.esolangs.org/edit/')
7 7
8 f = os.path.realpath(sys.argv[1]) 8 f = os.path.realpath(sys.argv[1])
9 f = re.sub(r"^/+hackenv/", "", f) 9 f = re.sub(r"^/+hackenv/", "", f)
10 if re.match(r"/|\.hg(?:/|ignore$|$)",f): 10 if re.match(r"/|\.hg(?:/|ignore$|$)",f):
11 sys.exit("File is not editable.") 11 sys.exit("File is not editable.")
12 print 'https://hackego.esolangs.org/edit/' + urllib.quote(f) 12 print 'https://hack.esolangs.org/edit/' + urllib.quote(f)