add -y to bypass prompt for transformers-cli upload (#7035)

This commit is contained in:
Stas Bekman
2020-09-10 01:58:29 -07:00
committed by GitHub
parent 76818cc4c6
commit 4ee1053dcf
2 changed files with 13 additions and 4 deletions

View File

@@ -40,6 +40,7 @@ class UserCommands(BaseTransformersCLICommand):
upload_parser.add_argument(
"--filename", type=str, default=None, help="Optional: override individual object filename on S3."
)
upload_parser.add_argument("-y", "--yes", action="store_true", help="Optional: answer Yes to the prompt")
upload_parser.set_defaults(func=lambda args: UploadCommand(args))
@@ -221,10 +222,11 @@ class UploadCommand(BaseUserCommand):
)
)
choice = input("Proceed? [Y/n] ").lower()
if not (choice == "" or choice == "y" or choice == "yes"):
print("Abort")
exit()
if not self.args.yes:
choice = input("Proceed? [Y/n] ").lower()
if not (choice == "" or choice == "y" or choice == "yes"):
print("Abort")
exit()
print(ANSI.bold("Uploading... This might take a while if files are large"))
for filepath, filename in files:
try: