mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 19:58:09 +02:00
tools/trace: More helpful message when no args are provided.
This commit is contained in:
parent
54536686b2
commit
4a93414985
1 changed files with 13 additions and 13 deletions
|
|
@ -364,23 +364,23 @@ class Main:
|
|||
optparser = self.get_optparser()
|
||||
(options, args) = optparser.parse_args(sys.argv[1:])
|
||||
|
||||
if args:
|
||||
for arg in args:
|
||||
if arg.endswith('.gz'):
|
||||
from gzip import GzipFile
|
||||
stream = GzipFile(arg, 'rt')
|
||||
elif arg.endswith('.bz2'):
|
||||
from bz2 import BZ2File
|
||||
stream = BZ2File(arg, 'rU')
|
||||
else:
|
||||
stream = open(arg, 'rt')
|
||||
self.process_arg(stream, options)
|
||||
else:
|
||||
if not args:
|
||||
optparser.error('insufficient number of arguments')
|
||||
|
||||
for arg in args:
|
||||
if arg.endswith('.gz'):
|
||||
from gzip import GzipFile
|
||||
stream = GzipFile(arg, 'rt')
|
||||
elif arg.endswith('.bz2'):
|
||||
from bz2 import BZ2File
|
||||
stream = BZ2File(arg, 'rU')
|
||||
else:
|
||||
stream = open(arg, 'rt')
|
||||
self.process_arg(stream, options)
|
||||
|
||||
def get_optparser(self):
|
||||
optparser = optparse.OptionParser(
|
||||
usage="\n\t%prog [options] [traces] ...")
|
||||
usage="\n\t%prog [options] TRACE [...]")
|
||||
return optparser
|
||||
|
||||
def process_arg(self, stream, options):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue