clit 0.3.1.0 → 0.3.2.0
raw patch · 4 files changed
+14/−8 lines, 4 filesdep ~clit
Dependency ranges changed: clit
Files
- clit.cabal +2/−2
- src/Web/Tweet.hs +2/−1
- src/Web/Tweet/Utils.hs +9/−4
- stack.yaml +1/−1
clit.cabal view
@@ -1,5 +1,5 @@ name: clit-version: 0.3.1.0+version: 0.3.2.0 cabal-version: >=1.10 build-type: Simple license: BSD3@@ -65,7 +65,7 @@ main-is: Main.hs build-depends: base >=4.9.1.0 && <4.10,- clit >=0.3.1.0 && <0.4+ clit >=0.3.2.0 && <0.4 default-language: Haskell2010 hs-source-dirs: app
src/Web/Tweet.hs view
@@ -73,6 +73,7 @@ -- | Helper function to make `thread` easier to write. thread' :: [String] -> [String] -> Maybe Int -> Int -> FilePath -> IO () thread' content hs idNum num filepath = do+ -- fix the stuff with the handles. let f = \str i -> tweetData (Tweet { _status = str, _trimUser = True, _handles = hs, _replyID = if i == 0 then Nothing else Just i }) filepath let initial = f (head content) last <- foldr ((>=>) . f) initial (content) $ fromMaybe 0 idNum@@ -116,7 +117,7 @@ showTimeline count color filepath = showTweets color <$> getTimeline count filepath -showTweets color = {-- replace "\\n" "\n" . --} replace "\\/" "/" . fromRight . (fmap (if color then displayTimelineColor else displayTimeline))+showTweets color = fromRight . (fmap (if color then displayTimelineColor else displayTimeline)) where fromRight (Right a) = a getDMs count filepath = do
src/Web/Tweet/Utils.hs view
@@ -26,11 +26,11 @@ displayTimeline ((user,content):rest) = (user <> ":\n " <> content <> "\n") <> (displayTimeline rest) -- color should be configurable at least! displayTimeline [] = [] --- | Get tweets from a response, disgarding all but author and -getTweets str = zip <$> (parse (filterStr "screen_name") "" str) <*> (parse (filterStr "text") "" str)+-- | Get tweets from a response, disgarding all but author and content+getTweets str = zip <$> (parse (filterStr "name") "" str) <*> (parse (filterStr "text") "" str) filterTl :: Parser Timeline-filterTl = zip <$> (filterStr "screen_name") <*> (filterStr "text")+filterTl = zip <$> (filterStr "name") <*> (filterStr "text") filterStr :: String -> Parser [String] filterStr str = (fmap (filter (/=""))) . many $@@ -41,9 +41,14 @@ string $ "\"" <> str <> "\"" char ':' char '\"'- want <- many $ noneOf "\""+ want <- many $ noneOf "\\\"" <|> specialChar '\"' <|> specialChar '/' <|> specialChar 'n' <|> specialChar 'u' char '\"' pure want++specialChar :: Char -> Parser Char+specialChar c = do+ string $ "\\" ++ pure c+ if c /= '\n' then pure c else pure '\n' -- | helper function to get the key as read from a file keyLinePie :: String -> String
stack.yaml view
@@ -15,7 +15,7 @@ # resolver: # name: custom-snapshot # location: "./custom-snapshot.yaml"-resolver: lts-8.3+resolver: lts-8.4 # User packages to be built. # Various formats can be used as shown in the example below.