<commit_before>{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ImpredicativeTypes #-}
module Main where

import Control.Monad.Error
import Control.Monad.State
import Control.Monad.Writer
import Data.Either
import Data.Generics
import Data.Char
import Data.List
import Data.Data
import Data.Typeable
import Data.Maybe
import Data.String
-- import qualified Data.Text as T
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as BS
import Language.JavaScript.Parser
import Options.Applicative
import System.Environment
import System.Process
import System.Exit
import System.IO
-- import System.FilePath
import System.Directory
import System.Info
import Text.Printf

import Development.Cake3
import Development.Cake3.Ext.UrWeb


import Paths_cake3

io :: (MonadIO m) => IO a -> m a
io = liftIO

hio :: (MonadIO m) => Handle -> String -> m ()
hio h = io . hPutStrLn h

err,out :: (MonadIO m) => String -> m ()
err = hio stderr
out = hio stdout

data Args = A
  { tgtdir :: FilePath
  , fversion :: Bool
  , dontrunmake :: Bool
  , dontscan :: Bool
  , files :: [FilePath]
  }

pargs :: Parser Args
pargs = A
  <$> strOption
      (  long "output"
      <> short 'o'
      <> metavar "FILE.urp"
      <> help "Name of the Ur/Web project being generated"
      <> value "")
  <*> flag False True ( long "version" <> help "Show version information" )
  <*> flag False True ( long "dont-run-make" <> help "Do not run the makefile generated" )
  <*> flag False True ( long "dont-scan" <> help "Do not generate JS/CSS FFI declarations" )
  <*> arguments str ( metavar "FILE" <> help "File to embed" )

main :: IO ()
main = do
  h <- (getDataFileName >=> readFile) "UrEmbedHelp.txt" 
  main_ =<< execParser (
    info (helper <*> pargs)
      (  fullDesc
      <> progDesc h
      <> header "UrEmebed is the Ur/Web module generator" ))


main_ (A tgturp True drm ds ins) = do<commit_msg>UrEmbed: fix optparse-applicative compatibility<commit_after>{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ImpredicativeTypes #-}
module Main where

import Control.Monad.Error
import Control.Monad.State
import Control.Monad.Writer
import Data.Either
import Data.Generics
import Data.Char
import Data.List
import Data.Data
import Data.Typeable
import Data.Maybe
import Data.String
-- import qualified Data.Text as T
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as BS
import Language.JavaScript.Parser
import Options.Applicative
import System.Environment
import System.Process
import System.Exit
import System.IO
-- import System.FilePath
import System.Directory
import System.Info
import Text.Printf

import Development.Cake3
import Development.Cake3.Ext.UrWeb


import Paths_cake3

io :: (MonadIO m) => IO a -> m a
io = liftIO

hio :: (MonadIO m) => Handle -> String -> m ()
hio h = io . hPutStrLn h

err,out :: (MonadIO m) => String -> m ()
err = hio stderr
out = hio stdout

data Args = A
  { tgtdir :: FilePath
  , fversion :: Bool
  , dontrunmake :: Bool
  , dontscan :: Bool
  , files :: [FilePath]
  }

pargs :: Parser Args
pargs = A
  <$> strOption
      (  long "output"
      <> short 'o'
      <> metavar "FILE.urp"
      <> help "Name of the Ur/Web project being generated"
      <> value "")
  <*> flag False True ( long "version" <> help "Show version information" )
  <*> flag False True ( long "dont-run-make" <> help "Do not run the makefile generated" )
  <*> flag False True ( long "dont-scan" <> help "Do not generate JS/CSS FFI declarations" )
  <*> many (argument str ( metavar "FILE" <> help "File to embed" ))

main :: IO ()
main = do
  h <- (getDataFileName >=> readFile) "UrEmbedHelp.txt" 
  main_ =<< execParser (
    info (helper <*> pargs)
      (  fullDesc
      <> progDesc h
      <> header "UrEmebed is the Ur/Web module generator" ))


main_ (A tgturp True drm ds ins) = do
{'fraction_non_alphanumeric': 0.11945564516129033, 'fraction_numerical': 0.0025201612903225806, 'mean_word_length': 3.5, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7238121', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1309, 'n_words': 423}