open Printf
open Deck

let () =
    Config.load_from_file (Dotfiles.config_filename ());
    Config.load_from_argv "Usage: cardflasher [options] [decks]";

    let deck = 
        List.flatten (List.map Deck.of_filename !Config.filenames) 
    in
    let deck = 
        if !Config.flip then
            List.map (fun card -> 
                          {front = card.back; back = card.front; level = 0})
                deck
        else
            deck
    in

    (*let deck = Data.load_scores deck in*)
    let main = match !Config.ui with
        | Config.Simple -> SimpleUi.main
        | Config.Gtk -> Gui.main
        | _ -> eprintf "Sorry, the UI you chose isn't ready yet."; exit 1
    in
    
    if deck = [] then
        (eprintf "No deck/empty deck specified!\n"; exit 1)
    else
        main deck
