#!/usr/bin/env python3 # -*-coding:utf-8 -* import sauth import getpass import argparse parser = argparse.ArgumentParser(description=""" Add a user with its password """, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('username', help="Username to add") parser.add_argument('--password', '-p', help="Password. If not provided will be asked", type=str, dest='password') args = parser.parse_args() if args.password is None : password = getpass.getpass('Password : ') else: password = args.password sa = sauth.SAuth() if sa.add_user(args.username, password): print("User added !") else: print("An error occured (user already present for instance)")