Streaming read
This commit is contained in:
		
							
								
								
									
										22
									
								
								app/Main.hs
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								app/Main.hs
									
									
									
									
									
								
							@@ -1,8 +1,22 @@
 | 
			
		||||
{-# LANGUAGE LambdaCase #-}
 | 
			
		||||
module Main where
 | 
			
		||||
 | 
			
		||||
import qualified MyLib (someFunc)
 | 
			
		||||
import Options.Applicative
 | 
			
		||||
 | 
			
		||||
import qualified Control.Addressbook.Streaming as Streaming
 | 
			
		||||
 | 
			
		||||
data CmdLine
 | 
			
		||||
  = Stream
 | 
			
		||||
  deriving Show
 | 
			
		||||
 | 
			
		||||
cmdline :: Parser CmdLine
 | 
			
		||||
cmdline = subparser (command "stream" (info (pure Stream) (progDesc "Record a stream of filenames")))
 | 
			
		||||
 | 
			
		||||
handler :: CmdLine -> IO ()
 | 
			
		||||
handler = \case
 | 
			
		||||
  Stream -> Streaming.run
 | 
			
		||||
 | 
			
		||||
main :: IO ()
 | 
			
		||||
main = do
 | 
			
		||||
  putStrLn "Hello, Haskell!"
 | 
			
		||||
  MyLib.someFunc
 | 
			
		||||
main = execParser opts >>= handler
 | 
			
		||||
  where
 | 
			
		||||
    opts = info (cmdline <**> helper) (fullDesc <> progDesc "Email addressbook")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user