feature request for dan and +33 bugfix

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-03-30 08:20:37 +00:00
parent 1b8c01e319
commit c7da3f12c3
1 changed files with 20 additions and 6 deletions

View File

@ -812,6 +812,18 @@ if __name__ == "__main__":
ciphers = { 'none': open_plain_file, 'aes': open_aes_file }
linetypes = { 'win': '\r\n', 'mac': '\r', 'unix': '\n' }
# preprocess args
argv = list(sys.argv[1:])
goto_line = None
i = 0
while i < len(argv):
if argv[i] == '-nw':
del argv[i]
elif argv[i].startswith('+'):
goto_line = int(argv.pop(i))
else:
i += 1
import optparse
parser = optparse.OptionParser()
@ -835,7 +847,7 @@ if __name__ == "__main__":
parser.add_option('-m', '--mode', dest='mode', metavar='MODE',
help='open arguments in MODE')
(opts, args) = parser.parse_args()
(opts, args) = parser.parse_args(argv)
# if debugging, disable error handling to produce backtraces
if opts.debug:
@ -843,12 +855,14 @@ if __name__ == "__main__":
# we will support using +19 as the first argument to indicate opening the
# first file on line 19 (same as -g 19 or --goto 19)
if len(args) > 0 and args[0].startswith('+'):
opts.goto = int(args[0][1:])
args = args[1:]
if goto_line:
opts.goto = goto_line
#if len(args) > 0 and args[0].startswith('+'):
# opts.goto = int(args[0][1:])
# args = args[1:]
if opts.goto is not None:
opts.goto += 1
#if opts.goto is not None:
# opts.goto += 1
# figure out which kind of line types we're using
if opts.linetype not in linetypes: