main = do
  argv <- getArgs

  let (Options host port, rest) =
          case getOpt Permute globalArgSpec argv of
            (o,r,[]  ) -> (foldr id (Options "localhost" "1234") o, r)
            (_,_,errs) -> error $
              "Parsing command line options failed: " ++ concat errs

  case (rest) of
    ["login", uri, uid, ua] -> do
        let Just uri' = parseURI uri
        print =<< runOHST host port (login uri' (UId uid))
    ["register", _url, _locator, _cookies] -> print =<< runOHST host port register -- mock
    "login":_ -> putStrLn $ usage "login"
    "register":_ -> putStrLn $ usage "register"
    _ -> putStrLn "Usage: login | register ..."
main = do
  argv <- getArgs

  let (Options host port, rest) =
          case getOpt Permute globalArgSpec argv of
            (o,r,[]  ) -> (foldr id (Options "localhost" "1234") o, r)
            (_,_,errs) -> error $
              "Parsing command line options failed: " ++ concat errs

  case (rest) of
    ["login", uri, uid, ua] -> do
        let Just uri' = parseURI uri
        print =<< runOHST host port (login uri' (UId uid))
    ["register", _url, _locator, _cookies] -> print =<< runOHST host port register -- mock
    "login":_ -> putStrLn $ usage "login"
    "register":_ -> putStrLn $ usage "register"
    _ -> putStrLn "Usage: login | register ..."
main = do
  argv <- getArgs

  let (Options host port, rest) =
          case getOpt Permute globalArgSpec argv of
            (o,r,[]  ) -> (foldr id (Options "localhost" "1234") o, r)
            (_,_,errs) -> error $
              "Parsing command line options failed: " ++ concat errs

  case (rest) of
    ["login", uri, uid, ua] -> do
        let Just uri' = parseURI uri
        print =<< runOHST host port (login uri' (UId uid))
    ["register", _url, _locator, _cookies] -> print =<< runOHST host port register -- mock
    "login":_ -> putStrLn $ usage "login"
    "register":_ -> putStrLn $ usage "register"
    _ -> putStrLn "Usage: login | register ..."