fail when passing non integer

This commit is contained in:
q
2015-07-19 20:53:58 +03:00
parent 3df5a80340
commit 704d3c0df0
2 changed files with 10 additions and 4 deletions

View File

@@ -43,8 +43,11 @@ Simple implementation of head that keeps the header row.
help="File(s) to be headed")
opts=parser.parse_args()
if not opts.lines:
int(opts.file[0])
opts.lines=int(opts.file.pop(0))
try:
int(opts.file[0])
opts.lines=int(opts.file.pop(0))
except:
pass
if not opts.lines:
opts.lines=10
return opts