Skip to content

Commit

Permalink
* add interact argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Jintin committed May 22, 2016
1 parent d585c70 commit 83e1221
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
6 changes: 3 additions & 3 deletions andle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import andle.android
import andle.sdk

__version__ = "1.5.6"
__version__ = "1.6.0"


def update(path, dryrun, remote, gradle):
def update(path, dryrun, remote, gradle, interact):
data = sdk.load()
android.update(path, data, dryrun, remote, gradle)
android.update(path, data, dryrun, remote, gradle, interact)


def setsdk(path):
Expand Down
13 changes: 12 additions & 1 deletion andle/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@
import fnmatch
import andle.remote
import andle.gradle
try:
import __builtin__
input = getattr(__builtin__, 'raw_input')
except (ImportError, AttributeError):
pass

COMPILE_TAGS = ["compile", "Compile"]


def update(path, data, dryrun=False, remote=False, gradle=False):
def update(path, data, dryrun=False, remote=False, gradle=False, interact=False):
global is_dryrun
is_dryrun = dryrun
global check_remote
check_remote = remote
global check_gradle
check_gradle = gradle
global is_interact
is_interact = interact

for file in filter(path, "build.gradle"):
parse_dependency(file, data)
Expand Down Expand Up @@ -132,6 +139,10 @@ def update_value(name, old, new):
if old == new or new == None:
return
print(name + ": " + old + " -> " + new)

if is_interact and input("> ") == "n":
print("not modify")
return
global modify
modify = True
global line
Expand Down
3 changes: 2 additions & 1 deletion bin/andle
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ update_cmd.add_argument("-p", "--path", type=str, default=".", help="root path")
update_cmd.add_argument("-d", "--dryrun", action='store_true', help="dryrun")
update_cmd.add_argument("-g", "--gradle", action='store_true', help="check gradle version")
update_cmd.add_argument("-r", "--remote", action='store_true', help="check jcenter repository")
update_cmd.add_argument("-i", "--interact", action='store_true', help="interact")

sdk_cmd = subparsers.add_parser(SETSDK, help="set sdk command")
sdk_cmd.add_argument("-p", "--path", required=True, type=str, default=".", help="sdk path")

args = parser.parse_args()

if args.sub_command == UPDATE:
andle.update(args.path, args.dryrun, args.remote, args.gradle)
andle.update(args.path, args.dryrun, args.remote, args.gradle, args.interact)
elif args.sub_command == SETSDK:
andle.setsdk(args.path)

0 comments on commit 83e1221

Please sign in to comment.