Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import argparse
- import sys
- def main():
- parseit = argparse.ArgumentParser(description="Log into any of FB, Twitter, Gmail, and Yahoo using <username> and <password>")
- root_group = parseit.add_argument_group()
- creds_group = root_group.add_mutually_exclusive_group(required=True)
- creds_group.add_argument('-b','--ball', action='store_false',help="Log into all accounts")
- file_group = creds_group.add_argument_group()
- file_group.add_argument('-i','--file', type=file, help="Log in with credentials in file with format as 'username:password'")
- inline_creds = creds_group.add_argument_group()
- inline_creds.add_argument("username",help="Username to log in as")
- inline_creds.add_argument("password",help="Password to log in with")
- site_group = root_group.add_mutually_exclusive_group()
- site_group.add_argument('-a','--all', action='store_false',help="Log into all accounts")
- sites_avail = site_group.add_argument_group("Site Set","none")
- sites_avail.add_argument('-t','--twitter', action='store_false',help="Log into Twitter")
- sites_avail.add_argument('-f','--facebook', action='store_false',help="Log into Facebook")
- sites_avail.add_argument('-y','--yahoo', action='store_false',help="Log into Yahoo")
- sites_avail.add_argument('-g','--gmail', action='store_false',help="Log into Gmail")
- parseit.print_help()
- """
- I get this error IndexError: list index out of range
- I found this but the goals of the op is different than mine: https://stackoverflow.com/questions/30499648/python-mutually-exclusive-arguments-complains-about-action-index
- """
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement