Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dnsviz/dnsviz.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasey Deccio <casey@deccio.net>2019-01-24 08:24:08 +0300
committerCasey Deccio <casey@deccio.net>2019-01-24 08:24:08 +0300
commit475d5497fdc2b3ada461399278c0f8cf6e6fc652 (patch)
treedcd81ced3e5709842e50557a866c35febc086a9d
parent8d716ea3a8d90b66f419cbfef550afc64353f563 (diff)
Don't show usage on every error
-rwxr-xr-xbin/dnsviz4
-rw-r--r--dnsviz/commands/graph.py12
-rw-r--r--dnsviz/commands/grok.py6
-rw-r--r--dnsviz/commands/print.py10
-rw-r--r--dnsviz/commands/query.py10
5 files changed, 21 insertions, 21 deletions
diff --git a/bin/dnsviz b/bin/dnsviz
index 04cadd3..c2bbdc1 100755
--- a/bin/dnsviz
+++ b/bin/dnsviz
@@ -58,7 +58,7 @@ def main():
try:
opts, args = getopt.getopt(sys.argv[1:], 'p:')
except getopt.GetoptError as e:
- usage(str(e))
+ sys.stderr.write('%s\n' % str(e))
sys.exit(1)
opts = dict(opts)
@@ -94,7 +94,7 @@ def main():
if exc_frame.tb_next.tb_next is not None:
raise
- usage('Invalid command: %s' % command)
+ sys.stderr.write('Invalid command: %s\n' % command)
sys.exit(1)
if args[0] == 'help':
diff --git a/dnsviz/commands/graph.py b/dnsviz/commands/graph.py
index 2512f6e..f7faa3e 100644
--- a/dnsviz/commands/graph.py
+++ b/dnsviz/commands/graph.py
@@ -156,7 +156,7 @@ def main(argv):
try:
opts, args = getopt.getopt(argv[1:], 'f:r:R:et:COo:T:h')
except getopt.GetoptError as e:
- usage(str(e))
+ sys.stderr.write('%s\n' % str(e))
sys.exit(1)
# collect trusted keys
@@ -181,19 +181,19 @@ def main(argv):
sys.exit(0)
if '-f' in opts and args:
- usage('If -f is used, then domain names may not supplied as command line arguments.')
+ sys.stderr.write('If -f is used, then domain names may not supplied as command line arguments.\n')
sys.exit(1)
if '-R' in opts:
try:
rdtypes = opts['-R'].split(',')
except ValueError:
- usage('The list of types was invalid: "%s"' % opts['-R'])
+ sys.stderr.write('The list of types was invalid: "%s"\n' % opts['-R'])
sys.exit(1)
try:
rdtypes = [dns.rdatatype.from_text(x) for x in rdtypes]
except dns.rdatatype.UnknownRdatatype:
- usage('The list of types was invalid: "%s"' % opts['-R'])
+ sys.stderr.write('The list of types was invalid: "%s"\n' % opts['-R'])
sys.exit(1)
else:
rdtypes = None
@@ -209,11 +209,11 @@ def main(argv):
else:
fmt = 'dot'
if fmt not in ('dot','png','jpg','svg','html'):
- usage('Image format unrecognized: "%s"' % fmt)
+ sys.stderr.write('Image format unrecognized: "%s"\n' % fmt)
sys.exit(1)
if '-o' in opts and '-O' in opts:
- usage('The -o and -O options may not be used together.')
+ sys.stderr.write('The -o and -O options may not be used together.\n')
sys.exit(1)
if '-r' not in opts or opts['-r'] == '-':
diff --git a/dnsviz/commands/grok.py b/dnsviz/commands/grok.py
index 839b404..d83e33b 100644
--- a/dnsviz/commands/grok.py
+++ b/dnsviz/commands/grok.py
@@ -170,7 +170,7 @@ def main(argv):
try:
opts, args = getopt.getopt(argv[1:], 'f:r:t:Co:cl:h')
except getopt.GetoptError as e:
- usage(str(e))
+ sys.stderr.write('%s\n' % str(e))
sys.exit(1)
# collect trusted keys
@@ -195,7 +195,7 @@ def main(argv):
sys.exit(0)
if '-f' in opts and args:
- usage('If -f is used, then domain names may not supplied as command line arguments.')
+ sys.stderr.write('If -f is used, then domain names may not supplied as command line arguments.\n')
sys.exit(1)
if '-l' in opts:
@@ -208,7 +208,7 @@ def main(argv):
elif opts['-l'] == 'debug':
loglevel = logging.DEBUG
else:
- usage('Invalid log level: "%s"' % opts['-l'])
+ sys.stderr.write('Invalid log level: "%s"\n' % opts['-l'])
sys.exit(1)
else:
loglevel = logging.DEBUG
diff --git a/dnsviz/commands/print.py b/dnsviz/commands/print.py
index 9dd6365..7a3525f 100644
--- a/dnsviz/commands/print.py
+++ b/dnsviz/commands/print.py
@@ -312,7 +312,7 @@ def main(argv):
try:
opts, args = getopt.getopt(argv[1:], 'f:r:R:t:COo:h')
except getopt.GetoptError as e:
- usage(str(e))
+ sys.stderr.write('%s\n' % str(e))
sys.exit(1)
# collect trusted keys
@@ -337,19 +337,19 @@ def main(argv):
sys.exit(0)
if '-f' in opts and args:
- usage('If -f is used, then domain names may not supplied as command line arguments.')
+ sys.stderr.write('If -f is used, then domain names may not supplied as command line arguments.\n')
sys.exit(1)
if '-R' in opts:
try:
rdtypes = opts['-R'].split(',')
except ValueError:
- usage('The list of types was invalid: "%s"' % opts['-R'])
+ sys.stderr.write('The list of types was invalid: "%s"\n' % opts['-R'])
sys.exit(1)
try:
rdtypes = [dns.rdatatype.from_text(x) for x in rdtypes]
except dns.rdatatype.UnknownRdatatype:
- usage('The list of types was invalid: "%s"' % opts['-R'])
+ sys.stderr.write('The list of types was invalid: "%s"\n' % opts['-R'])
sys.exit(1)
else:
rdtypes = None
@@ -357,7 +357,7 @@ def main(argv):
strict_cookies = '-C' in opts
if '-o' in opts and '-O' in opts:
- usage('The -o and -O options may not be used together.')
+ sys.stderr.write('The -o and -O options may not be used together.\n')
sys.exit(1)
if '-r' not in opts or opts['-r'] == '-':
diff --git a/dnsviz/commands/query.py b/dnsviz/commands/query.py
index 49f1078..ff63deb 100644
--- a/dnsviz/commands/query.py
+++ b/dnsviz/commands/query.py
@@ -95,12 +95,12 @@ class DVCommandLineQuery:
if not arg:
raise ValueError()
except ValueError:
- usage('+trusted-key requires a filename argument.')
+ sys.stderr.write('+trusted-key requires a filename argument.\n')
sys.exit(1)
else:
self.trusted_keys_file = arg
else:
- usage('Option "%s" not recognized.' % arg)
+ sys.stderr.write('Option "%s" not recognized.\n' % arg)
sys.exit(1)
def process_nameservers(self, nameservers, use_ipv4, use_ipv6):
@@ -214,7 +214,7 @@ class DVCommandLine:
try:
if len(self.args[self.arg_index]) > 2:
if not has_arg:
- usage('"%s" option does not take arguments' % self.args[self.arg_index][:2])
+ sys.stderr.write('"%s" option does not take arguments\n' % self.args[self.arg_index][:2])
sys.exit(1)
return self.args[self.arg_index][2:]
else:
@@ -223,7 +223,7 @@ class DVCommandLine:
else:
self.arg_index += 1
if self.arg_index >= len(self.args):
- usage('"%s" option requires an argument' % self.args[self.arg_index - 1])
+ sys.stderr.write('"%s" option requires an argument\n' % self.args[self.arg_index - 1])
sys.exit(1)
return self.args[self.arg_index]
finally:
@@ -350,7 +350,7 @@ class DVCommandLine:
self._get_arg(False)
self.options['use_ipv4'] = True
else:
- usage('Option "%s" not recognized.' % self.args[self.arg_index][:2])
+ sys.stderr.write('Option "%s" not recognized.\n' % self.args[self.arg_index][:2])
sys.exit(1)
def _add_query_option(self, query):