searchAndGetTree :: FilePath -> Int -> Int -> Pattern -> IO (Text, [Text])
searchAndGetTree wdir depth sourcelines pattern = do
    (trees, err_files) <- runTreeGenerator $ wordToTree wdir depth sourcelines pattern Nothing
    output_trees <- convertToOutputTree trees
    let jsn = jsonToText $ AllTree {
                             nameA = "main",
                             primary_wordA = Just pattern,
                             cornersA = pattern,
                             childrenA = output_trees,
                             err_filesA = err_files
                           }
    return (jsn, err_files)

----------------------------------------------------------------------------
searchAndGetTree :: FilePath -> Int -> Int -> Pattern -> IO (Text, [Text])
searchAndGetTree wdir depth sourcelines pattern = do
    (trees, err_files) <- runTreeGenerator $ wordToTree wdir depth sourcelines pattern Nothing
    output_trees <- convertToOutputTree trees
    let jsn = jsonToText $ AllTree {
                             nameA = "main",
                             primary_wordA = Just pattern,
                             cornersA = pattern,
                             childrenA = output_trees,
                             err_filesA = err_files
                           }
    return (jsn, err_files)

----------------------------------------------------------------------------
searchAndGetTree wdir depth sourcelines pattern = do
    (trees, err_files) <- runTreeGenerator $ wordToTree wdir depth sourcelines pattern Nothing
    output_trees <- convertToOutputTree trees
    let jsn = jsonToText $ AllTree {
                             nameA = "main",
                             primary_wordA = Just pattern,
                             cornersA = pattern,
                             childrenA = output_trees,
                             err_filesA = err_files
                           }
    return (jsn, err_files)

----------------------------------------------------------------------------