def main(params=None):
    """
    Main function to launch alias_generator.

    Args:
    -----
        params: A list with the parameters as grabbed by the terminal. It is
            None when this is called by an entry_point. If it is called by osrf
            the data is already parsed.
    """
    if params == None:
        parser = getParser()
        args = parser.parse_args(params)
    else:
        args = params

    print(general.title(banner.text))

    extraWords = args.extra_words

    try:
        if args.name == None and args.surname1 == None and args.surname2 == None and args.city == None and args.country == None and args.year == None:
            print("\nCollecting information about the profile")
            print("----------------------------------------\n")

            args.name = raw_input(general.emphasis("Insert a name: ".ljust(35, " "))).replace(' ','')
            args.surname1 = raw_input(general.emphasis("Insert the first surname: ".ljust(35, " "))).replace(' ','')
            args.surname2 = raw_input(general.emphasis("Insert the second surname: ".ljust(35, " "))).replace(' ','')
            args.year = raw_input(general.emphasis("Insert a year (e. g.: birthyear): ".ljust(35, " "))).replace(' ','')
            args.city = raw_input(general.emphasis("Insert a city: ".ljust(35, " "))).replace(' ','')
            args.country = raw_input(general.emphasis("Insert a country: ".ljust(35, " "))).replace(' ','')

            if args.extra_words == []:
                print("\nAdditional transformations to be added")
                print("--------------------------------------\n")
                inputText = raw_input(general.emphasis("Extra words to add (',' separated): ".ljust(35, " "))).replace(' ','')
                extraWords += inputText.lower().split(',')
    except KeyboardInterrupt:
        print("\n\nThe user manually aborted the program. Exiting...")
        sys.exit(2)

    lista=[]

    print("\nInput data:")
    print("-----------\n")
    if args.name != "":
        print("Name: ".ljust(20, " ") + args.name)
    if args.surname1 != "":
        print("First Surname: ".ljust(20, " ") + args.surname1)
    if args.surname2 != "":
        print("Second Surname: ".ljust(20, " ") + args.surname2)
    if args.year != "":
        print("Year: ".ljust(20, " ") + args.year)
    if args.city != "":
        print("City: ".ljust(20, " ") + args.city)
    if args.country != "":
        print("Country: ".ljust(20, " ") + args.country)

    aliases = generate(
        name=args.name,
        surname1=args.surname1,
        surname2=args.surname2,
        city=args.city,
        country=args.country,
        year=args.year,
        useNumbers=args.numbers,
        useCommonWords=args.common_words,
        useLeet=args.leet,
        useLocales=args.locales,
        extraWords=extraWords
    )

    print("Writing the results onto the file:\n\t" + general.emphasis(args.outputFile))

    oF=open(args.outputFile, "w")
    for l in aliases:
        oF.write(l+"\n")
    oF.close()


    # Urging users to place an issue on Github...
    print(banner.footer)
def main ( params = None ) : if params == None : parser = getParser ( ) args = parser . parse_args ( params ) else : args = params print ( general . title ( banner . text ) ) extraWords = args . extra_words try : if args . name == None and args . surname1 == None and args . surname2 == None and args . city == None and args . country == None and args . year == None : print ( "\nCollecting information about the profile" ) print ( "----------------------------------------\n" ) args . name = raw_input ( general . emphasis ( "Insert a name: " . ljust ( 35 , " " ) ) ) . replace ( ' ' , '' ) args . surname1 = raw_input ( general . emphasis ( "Insert the first surname: " . ljust ( 35 , " " ) ) ) . replace ( ' ' , '' ) args . surname2 = raw_input ( general . emphasis ( "Insert the second surname: " . ljust ( 35 , " " ) ) ) . replace ( ' ' , '' ) args . year = raw_input ( general . emphasis ( "Insert a year (e. g.: birthyear): " . ljust ( 35 , " " ) ) ) . replace ( ' ' , '' ) args . city = raw_input ( general . emphasis ( "Insert a city: " . ljust ( 35 , " " ) ) ) . replace ( ' ' , '' ) args . country = raw_input ( general . emphasis ( "Insert a country: " . ljust ( 35 , " " ) ) ) . replace ( ' ' , '' ) if args . extra_words == [ ] : print ( "\nAdditional transformations to be added" ) print ( "--------------------------------------\n" ) inputText = raw_input ( general . emphasis ( "Extra words to add (',' separated): " . ljust ( 35 , " " ) ) ) . replace ( ' ' , '' ) extraWords += inputText . lower ( ) . split ( ',' ) except KeyboardInterrupt : print ( "\n\nThe user manually aborted the program. Exiting..." ) sys . exit ( 2 ) lista = [ ] print ( "\nInput data:" ) print ( "-----------\n" ) if args . name != "" : print ( "Name: " . ljust ( 20 , " " ) + args . name ) if args . surname1 != "" : print ( "First Surname: " . ljust ( 20 , " " ) + args . surname1 ) if args . surname2 != "" : print ( "Second Surname: " . ljust ( 20 , " " ) + args . surname2 ) if args . year != "" : print ( "Year: " . ljust ( 20 , " " ) + args . year ) if args . city != "" : print ( "City: " . ljust ( 20 , " " ) + args . city ) if args . country != "" : print ( "Country: " . ljust ( 20 , " " ) + args . country ) aliases = generate ( name = args . name , surname1 = args . surname1 , surname2 = args . surname2 , city = args . city , country = args . country , year = args . year , useNumbers = args . numbers , useCommonWords = args . common_words , useLeet = args . leet , useLocales = args . locales , extraWords = extraWords ) print ( "Writing the results onto the file:\n\t" + general . emphasis ( args . outputFile ) ) oF = open ( args . outputFile , "w" ) for l in aliases : oF . write ( l + "\n" ) oF . close ( ) print ( banner . footer )
Main function to launch alias_generator.

    Args:
    -----
        params: A list with the parameters as grabbed by the terminal. It is
            None when this is called by an entry_point. If it is called by osrf
            the data is already parsed.