lineage-push: Add support for bool parameters

Change-Id: Icc6994c7ff2ab33e01fd7c91a870bb4dd31101ab
This commit is contained in:
Luca Stefani
2018-04-14 22:19:20 +02:00
parent 45c215cba1
commit 478f2ee6ed

View File

@@ -5,7 +5,7 @@ from __future__ import print_function
import re
import subprocess
import sys
from argparse import ArgumentParser
from argparse import ArgumentParser, ArgumentTypeError
def push(args):
@@ -54,6 +54,15 @@ def push(args):
sys.exit(subprocess.call(command, shell=True))
def str2bool(v):
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise ArgumentTypeError('Boolean value expected.')
def parse_cmdline():
parser = ArgumentParser(
description='Pushes a local git repository\'s changes to Gerrit for code review')