-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMain.hs
37 lines (30 loc) · 1.08 KB
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{-# LANGUAGE UnicodeSyntax #-}
module Main where
import Demo.Common
import System.Environment ( getArgs )
{----------------------------------------------------------------------
-- USB operations.
----------------------------------------------------------------------}
-- | Parse command line arguments.
--
-- * if @saveraw@ is given, run 'writeRawDataToDisk';
--
-- * if @inspect@ is given, run 'inspectData';
--
-- * otherwise, run 'testVideoStream';
--
main ∷ IO ()
main = do
let usage = "Usage: test [options]\n\
\\t-h|--help) display this help\n\
\\tsaveraw) get default video stream and save to disk\n\
\\tinspect) get default video stream and display headers\n\
\\t[default] prompt for configuration and save to disk\n"
args ← getArgs
let action = case args of
("-h":_) → putStr usage
("--help":_) → putStr usage
("saveraw":_) → writeRawDataToDisk
("inspect":_) → inspectData
_ → testVideoStream
catchCommonUSBException action