-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Manuel Leduc
committed
May 3, 2016
1 parent
13ea593
commit a3ea46f
Showing
3 changed files
with
46 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,42 @@ | ||
{-# LANGUAGE DeriveGeneric #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Main where | ||
|
||
import Lib | ||
import Options.Generic | ||
import System.Console.Haskeline (defaultSettings, runInputT, getInputLine, outputStrLn, InputT, getPassword) | ||
import Data.Foldable (forM_) | ||
|
||
data Options | ||
= Auth | ||
| Whoami | ||
| Publish | ||
| Search | ||
deriving (Generic, Show) | ||
|
||
|
||
instance ParseRecord Options | ||
|
||
auth :: IO () | ||
auth = runInputT defaultSettings operations | ||
where operations :: InputT IO () | ||
operations = do | ||
login <- getInputLine "login : " | ||
password <- getPassword Nothing "password : " | ||
case (login, password) of | ||
(Nothing, _) -> return () | ||
(_, Nothing) -> return () | ||
(Just x, Just y) -> outputStrLn $ x ++ " - " ++ y | ||
|
||
processOptions :: Options -> IO() | ||
processOptions x = case x of | ||
Auth -> auth | ||
Whoami -> putStrLn "whoami todo" | ||
Publish -> putStrLn "publish todo" | ||
Search -> putStrLn "search todo" | ||
|
||
|
||
main :: IO () | ||
main = someFunc | ||
main = do | ||
x <- getRecord "kreg" | ||
processOptions x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,8 @@ | ||
# This file was automatically generated by stack init | ||
# For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration/ | ||
|
||
# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2) | ||
resolver: lts-5.15 | ||
|
||
# Local packages, usually specified by relative directory name | ||
packages: | ||
- '.' | ||
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3) | ||
extra-deps: [] | ||
|
||
# Override default flag values for local packages and extra-deps | ||
flags: {} | ||
|
||
# Extra package databases containing global packages | ||
extra-package-dbs: [] | ||
|
||
# Control whether we use the GHC we find on the path | ||
# system-ghc: true | ||
|
||
# Require a specific version of stack, using version ranges | ||
# require-stack-version: -any # Default | ||
# require-stack-version: >= 1.0.0 | ||
|
||
# Override the architecture used by stack, especially useful on Windows | ||
# arch: i386 | ||
# arch: x86_64 | ||
|
||
# Extra directories used by stack for building | ||
# extra-include-dirs: [/path/to/dir] | ||
# extra-lib-dirs: [/path/to/dir] | ||
|
||
# Allow a newer minor version of GHC than the snapshot specifies | ||
# compiler-check: newer-minor | ||
packages: | ||
- '.' | ||
extra-deps: | ||
- optparse-generic-1.1.0 | ||
- text-1.2.2.1 | ||
resolver: lts-5.15 |