typing_test/typing_test.py
def main():
    """Parse arguments and start game based thereof"""
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawTextHelpFormatter,
        description=textwrap.dedent(
            """\
            Start a minimal 10fastfingers-like typing game on the command line.

            Keybinds:
                CTRL+R: restart
                CTRL+C: exit
            """
        ),
    )
    parser.add_argument(
        "-v",
        "--vocab",
        type=str,
        metavar="vocab-file-path",
        default=VOCAB_PATH,
        help="path to newline separated vocab file",
    )
    parser.add_argument(
        "-t",
        "--game_time",
        type=int,
        metavar="gametime-seconds",
        default=60,
        help="duration in seconds of the typing game",
    )
    parser.add_argument(
        "-min",
        "--min_length",
        type=int,
        metavar="min-word-length",
        default=2,
        help="minimum word length",
    )
    parser.add_argument(
        "-max",
        "--max_length",
        type=int,
        metavar="max-word-length",
        default=10,
        help="maximum word length",
    )
    parser.add_argument(
        "-w",
        "--words",
        type=int,
        metavar="words-to-read",
        default=200,
        help="the amount of words to read from vocab - higher increases difficulty",
    )
    parser.add_argument(
        "-a",
        "--advanced",
        action="store_const",
        const=1000,
        dest="words",
        help="use 1000 most common words (corresponds to 10ff advanced mode)",
    )
    parser.add_argument(
        "-d",
        "--display",
        type=str,
        metavar="display",
        default="10ff",
        help="how to display words to type '10ff' or 'progressive'",
    )
    args = parser.parse_args()
    game = Game(args)
    try:
        game.play()
    except KeyboardInterrupt:
        pass
Parse arguments and start game based thereof
Parse arguments and start game based thereof
Parse arguments and start game based thereof
def main():
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawTextHelpFormatter,
        description=textwrap.dedent(
            """\
            Start a minimal 10fastfingers-like typing game on the command line.
            Keybinds:
                CTRL+R: restart
                CTRL+C: exit
            """
        ),
    )
    parser.add_argument(
        "-v",
        "--vocab",
        type=str,
        metavar="vocab-file-path",
        default=VOCAB_PATH,
        help="path to newline separated vocab file",
    )
    parser.add_argument(
        "-t",
        "--game_time",
        type=int,
        metavar="gametime-seconds",
        default=60,
        help="duration in seconds of the typing game",
    )
    parser.add_argument(
        "-min",
        "--min_length",
        type=int,
        metavar="min-word-length",
        default=2,
        help="minimum word length",
    )
    parser.add_argument(
        "-max",
        "--max_length",
        type=int,
        metavar="max-word-length",
        default=10,
        help="maximum word length",
    )
    parser.add_argument(
        "-w",
        "--words",
        type=int,
        metavar="words-to-read",
        default=200,
        help="the amount of words to read from vocab - higher increases difficulty",
    )
    parser.add_argument(
        "-a",
        "--advanced",
        action="store_const",
        const=1000,
        dest="words",
        help="use 1000 most common words (corresponds to 10ff advanced mode)",
    )
    parser.add_argument(
        "-d",
        "--display",
        type=str,
        metavar="display",
        default="10ff",
        help="how to display words to type '10ff' or 'progressive'",
    )
    args = parser.parse_args()
    game = Game(args)
    try:
        game.play()
    except KeyboardInterrupt:
        pass
def main ( ) : parser = argparse . ArgumentParser ( formatter_class = argparse . RawTextHelpFormatter , description = textwrap . dedent ( """\
            Start a minimal 10fastfingers-like typing game on the command line.

            Keybinds:
                CTRL+R: restart
                CTRL+C: exit
            """ ) , ) parser . add_argument ( "-v" , "--vocab" , type = str , metavar = "vocab-file-path" , default = VOCAB_PATH , help = "path to newline separated vocab file" , ) parser . add_argument ( "-t" , "--game_time" , type = int , metavar = "gametime-seconds" , default = 60 , help = "duration in seconds of the typing game" , ) parser . add_argument ( "-min" , "--min_length" , type = int , metavar = "min-word-length" , default = 2 , help = "minimum word length" , ) parser . add_argument ( "-max" , "--max_length" , type = int , metavar = "max-word-length" , default = 10 , help = "maximum word length" , ) parser . add_argument ( "-w" , "--words" , type = int , metavar = "words-to-read" , default = 200 , help = "the amount of words to read from vocab - higher increases difficulty" , ) parser . add_argument ( "-a" , "--advanced" , action = "store_const" , const = 1000 , dest = "words" , help = "use 1000 most common words (corresponds to 10ff advanced mode)" , ) parser . add_argument ( "-d" , "--display" , type = str , metavar = "display" , default = "10ff" , help = "how to display words to type '10ff' or 'progressive'" , ) args = parser . parse_args ( ) game = Game ( args ) try : game . play ( ) except KeyboardInterrupt : pass
Parse arguments and start game based thereof
Parse arguments and start game based thereof
"""Parse arguments and start game based thereof"""