summaryrefslogtreecommitdiffstats
path: root/src/gallium/tools
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2012-10-26 09:46:29 +0100
committerJosé Fonseca <[email protected]>2012-10-26 10:50:48 +0100
commit4a9341498582891761e91599729adf6f2e2728a8 (patch)
tree6c6fd4c93c3a49f1f1c661f4a3166c3dcfbb07dd /src/gallium/tools
parent54536686b23f144b4734cc8f16daaf86d2bb8fb3 (diff)
tools/trace: More helpful message when no args are provided.
Diffstat (limited to 'src/gallium/tools')
-rwxr-xr-xsrc/gallium/tools/trace/parse.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/gallium/tools/trace/parse.py b/src/gallium/tools/trace/parse.py
index b08d3686715..feb0b64e231 100755
--- a/src/gallium/tools/trace/parse.py
+++ b/src/gallium/tools/trace/parse.py
@@ -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):