summaryrefslogtreecommitdiff
path: root/pint/pint-convert
diff options
context:
space:
mode:
authorJellby <jellby@yahoo.com>2020-02-10 20:12:33 +0100
committerJellby <jellby@yahoo.com>2020-02-10 20:12:33 +0100
commit5c51692227fe81d595764a35e685a435d91253cf (patch)
tree91cf10b20a008b33ea7fc156bc59780a443c9bcb /pint/pint-convert
parentc9fb459cea94b20937105da463cd2f65d3837628 (diff)
downloadpint-5c51692227fe81d595764a35e685a435d91253cf.tar.gz
Add pint-convert documentation
Diffstat (limited to 'pint/pint-convert')
-rwxr-xr-xpint/pint-convert8
1 files changed, 6 insertions, 2 deletions
diff --git a/pint/pint-convert b/pint/pint-convert
index ff17dec..da7df23 100755
--- a/pint/pint-convert
+++ b/pint/pint-convert
@@ -14,7 +14,7 @@ import sys
from pint import UnitRegistry
-parser = argparse.ArgumentParser(description='Unit converter.')
+parser = argparse.ArgumentParser(description='Unit converter.', usage=argparse.SUPPRESS)
parser.add_argument('-s', '--system', metavar='sys', default='SI', help='unit system to convert to (default: SI)')
parser.add_argument('-p', '--prec', metavar='n', type=int, default=12, help='number of maximum significant figures (default: 12)')
parser.add_argument('-u', '--prec-unc', metavar='n', type=int, default=2, help='number of maximum uncertainty digits (default: 2)')
@@ -22,7 +22,11 @@ parser.add_argument('-U', '--no-unc', dest='unc', action='store_false', help='ig
parser.add_argument('-C', '--no-corr', dest='corr', action='store_false', help='ignore correlations between constants')
parser.add_argument('fr', metavar='from', type=str, help='unit or quantity to convert from')
parser.add_argument('to', type=str, nargs='?', help='unit to convert to')
-args = parser.parse_args()
+try:
+ args = parser.parse_args()
+except SystemExit:
+ parser.print_help()
+ raise
ureg = UnitRegistry()
ureg.auto_reduce_dimensions = True