#!/usr/bin/env python

"""Command-line interface for boggle solver."""

import argparse
import time

from bogglesolver.solve_boggle import SolveBoggle


def main(args=None):
    """
    Main entry point for the Command-line-interface.

    Looking at this for good idea of command line interface.
    http://manpages.ubuntu.com/manpages/trusty/man6/boggle.6.html
    """
    min_length = 3
    column = 4
    row = 4
    game_time = 180

    parser = argparse.ArgumentParser()
    parser.add_argument('-p', '--play', action='store_true',
                        help="True if you want to play boggle.")
    parser.add_argument('-b', '--board', type=str,
                        help="String representing the Boggle Board.\
                              Prints out boards solutions.\
                              Currently not implemented.")
    parser.add_argument('-t', '--time', type=int,
                        help="int game time in seconds.")
    parser.add_argument('-l', '--length', type=int,
                        help="Change the minimum word length.")
    parser.add_argument('-w', '--words', type=str,
                        help="Get all words for a given list of letters.")

    args = parser.parse_args(args=args)

    if args.words:
        solver = SolveBoggle(args.words, column, row)
        print(solver.solve(False))

    if args.time:
        game_time = args.time

    if args.length:
        min_length = args.length

    if args.play:
        solver = SolveBoggle(['a'] * 16, column, row)
        solver.boggle.generate_boggle_board()
        words = solver.solve()
        print(solver.boggle)
        print("Play Boggle!!")
        time.sleep(game_time)
        # cont = input('Press enter to see the solution.')
        i = 0
        for i, word in enumerate(words):
            if len(word) >= min_length:
                print(word)
        print(str(i) + " words found.")
        exit()


if __name__ == '__main__':
    main()

@@ -600,247 +600,8 @@
 .%22)%0A
-    parser.add_argument('-b', '--board', type=str,%0A                        help=%22String representing the Boggle Board.%5C%0A                              Prints out boards solutions.%5C%0A                              Currently not implemented.%22)%0A
     
@@ -950,48 +950,361 @@
 .%22)%0A
-%0A    args = parser.parse_args(args=args)
+    parser.add_argument('-c', '--columns', type=int,%0A                        help=%22Set the number of columns.%22)%0A    parser.add_argument('-r', '--rows', type=int,%0A                        help=%22Set the number of rows.%22)%0A%0A    args = parser.parse_args(args=args)%0A%0A    if args.columns:%0A        column = args.columns%0A%0A    if args.rows:%0A        row = args.rows
 %0A%0A  
@@ -1564,77 +1564,46 @@
 gle(
-%5B'a'%5D * 16, column, row)%0A        solver.boggle.generate_boggle_board(
+)%0A        solver.set_board(column, row
 )%0A  

Fix Command Line for Issue #18