add args command name

This commit is contained in:
Valentin CZERYBA 2023-04-08 23:43:06 +02:00
parent ebc6206ec9
commit 7e484fa308

View File

@ -11,7 +11,7 @@ if __name__ == '__main__':
parser.add_argument("--logfile", help="Log file", default="")
parser.add_argument("--quiet", help="No console output", action="store_true")
subparsers = parser.add_subparsers()
subparsers = parser.add_subparsers(dest="command")
import_parser = subparsers.add_parser("import")
import_parser.add_argument("--user", help="wordpress user", required=True)
@ -33,6 +33,7 @@ if __name__ == '__main__':
args = parser.parse_args()
logger = logging.getLogger('insert wordpress')
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
@ -57,6 +58,7 @@ if __name__ == '__main__':
fileHandler.setFormatter(formatter)
logger.addHandler(fileHandler)
if args.command == "export":
password = getpass()
if len(password) == 0:
logger.error("No password error !!! ")