summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-10-17 10:11:11 +0100
committerCarl Hetherington <cth@carlh.net>2014-10-17 10:11:11 +0100
commit767b9fca10efb816cacb8179b96f52e9b62f0386 (patch)
tree29573c9ef623d0d9738c586f7c69d3f490cdcd9c
parent792a899eb73428f37f7dbe10a41061b8a8c53f2e (diff)
args needs to be global.
-rwxr-xr-xcdist36
1 files changed, 21 insertions, 15 deletions
diff --git a/cdist b/cdist
index 034ccdf..d1abfd8 100755
--- a/cdist
+++ b/cdist
@@ -558,21 +558,6 @@ def devel_to_git(project, filename):
#
def main():
- parser = argparse.ArgumentParser()
- parser.add_argument('command')
- parser.add_argument('-p', '--project', help='project name')
- parser.add_argument('-d', '--directory', help='directory within project repo', default='.')
- parser.add_argument('--minor', help='minor version number bump', action='store_true')
- parser.add_argument('--micro', help='micro version number bump', action='store_true')
- parser.add_argument('--major', help='major version to return with latest', type=int)
- parser.add_argument('-c', '--checkout', help='string to pass to git for checkout')
- parser.add_argument('-o', '--output', help='output directory', default='.')
- parser.add_argument('-q', '--quiet', help='be quiet', action='store_true')
- parser.add_argument('-t', '--target', help='target')
- parser.add_argument('-k', '--keep', help='keep working tree', action='store_true')
- parser.add_argument('--debug', help='build with debugging symbols where possible', action='store_true')
- parser.add_argument('-w', '--work', help='override default work directory')
- args = parser.parse_args()
args.output = os.path.abspath(args.output)
if args.work is not None:
@@ -789,6 +774,27 @@ def main():
else:
raise Error('invalid command %s' % args.command)
+
+#
+# Command-line parser
+#
+
+parser = argparse.ArgumentParser()
+parser.add_argument('command')
+parser.add_argument('-p', '--project', help='project name')
+parser.add_argument('-d', '--directory', help='directory within project repo', default='.')
+parser.add_argument('--minor', help='minor version number bump', action='store_true')
+parser.add_argument('--micro', help='micro version number bump', action='store_true')
+parser.add_argument('--major', help='major version to return with latest', type=int)
+parser.add_argument('-c', '--checkout', help='string to pass to git for checkout')
+parser.add_argument('-o', '--output', help='output directory', default='.')
+parser.add_argument('-q', '--quiet', help='be quiet', action='store_true')
+parser.add_argument('-t', '--target', help='target')
+parser.add_argument('-k', '--keep', help='keep working tree', action='store_true')
+parser.add_argument('--debug', help='build with debugging symbols where possible', action='store_true')
+parser.add_argument('-w', '--work', help='override default work directory')
+args = parser.parse_args()
+
try:
main()
except Error as e: