genArg :: String -> IP.IdrisParser a -> (a -> Command)
           -> String -> IP.IdrisParser (Either String Command)
genArg argName argParser cmd name = do
    let emptyArgs = do P.eof; failure
        oneArg = do arg <- argParser
                    P.eof
                    return (Right (cmd arg))
    P.try emptyArgs <|> oneArg <|> failure
    where
    failure = return $ Left ("Usage is :" ++ name ++ " <" ++ argName ++ ">")
genArg :: String -> IP.IdrisParser a -> (a -> Command)
           -> String -> IP.IdrisParser (Either String Command)
genArg argName argParser cmd name = do
    let emptyArgs = do P.eof; failure
        oneArg = do arg <- argParser
                    P.eof
                    return (Right (cmd arg))
    P.try emptyArgs <|> oneArg <|> failure
    where
    failure = return $ Left ("Usage is :" ++ name ++ " <" ++ argName ++ ">")
genArg argName argParser cmd name = do
    let emptyArgs = do P.eof; failure
        oneArg = do arg <- argParser
                    P.eof
                    return (Right (cmd arg))
    P.try emptyArgs <|> oneArg <|> failure
    where
    failure = return $ Left ("Usage is :" ++ name ++ " <" ++ argName ++ ">")