lineage-push: Add support for bool parameters
Change-Id: Icc6994c7ff2ab33e01fd7c91a870bb4dd31101ab
This commit is contained in:
@@ -5,7 +5,7 @@ from __future__ import print_function
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser, ArgumentTypeError
|
||||||
|
|
||||||
|
|
||||||
def push(args):
|
def push(args):
|
||||||
@@ -54,6 +54,15 @@ def push(args):
|
|||||||
sys.exit(subprocess.call(command, shell=True))
|
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():
|
def parse_cmdline():
|
||||||
parser = ArgumentParser(
|
parser = ArgumentParser(
|
||||||
description='Pushes a local git repository\'s changes to Gerrit for code review')
|
description='Pushes a local git repository\'s changes to Gerrit for code review')
|
||||||
|
|||||||
Reference in New Issue
Block a user