Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env stack
- -- stack --resolver=lts-3.18 runghc --package=shelly
- {-# LANGUAGE OverloadedStrings #-}
- {-# LANGUAGE DeriveDataTypeable #-} --TODO: temporary attr
- import Control.Monad
- import Shelly
- import System.Console.CmdArgs
- -- CLI options
- data NicoVideoDlArgs = NicoVideoDlArgs { nicoUsername :: String
- , nicoPassword :: String
- , nicoTargetId :: String
- }
- deriving (Show, Data, Typeable) -- TODO: temporary attr
- nicoVideoDlArgs :: NicoVideoDlArgs
- nicoVideoDlArgs = NicoVideoDlArgs
- { nicoUsername = "" &= name "username" &= explicit &= help "Your niconico email-address"
- , nicoPassword = "" &= name "password" &= explicit &= help "Your niconico acount password"
- , nicoTargetId = "" &= name "target" &= explicit &= help "Download target ID (for example: 'sm24868743')"
- main :: IO ()
- main = do
- print "foo"
- account <- getAccount
- print account
- -- Get completely account data
- getAccount :: IO NicoVideoDlArgs
- getAccount = do
- account <- cmdargs nicoVideoDlArgs
- username <- do
- if (not . null $ nicoUsername account) then
- return $ nicoUsername account
- else
- return $ "udonge.like@gmail.com" -- FIXME: temporary
- return NicoVideoDlArgs { nicoUsername = username
- , nicoPassword = "foo"
- , nicoTargetId = "sm24868743"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement