packages feed

clit 0.4.0.1 → 0.4.0.2

raw patch · 4 files changed

+26/−8 lines, 4 filesdep ~clit

Dependency ranges changed: clit

Files

README.md view
@@ -1,5 +1,6 @@ # Command Line Interface Tweeter +![Displaying a user timeline in a terminal.](https://raw.githubusercontent.com/vmchale/command-line-tweeter/master/screenshot.png) ## Config Generate a token to authorize access to your twitter account by following the guide [here](https://dev.twitter.com/oauth/overview/application-owner-access-tokens) @@ -14,8 +15,11 @@  ## Installation -Install [haskell stack](https://docs.haskellstack.org/en/stable/README/#how-to-install); on unix systems this is as simple as+If you're on Linux/Windows the best way is probably to download the binaries+from the releases page [here](https://github.com/vmchale/command-line-tweeter/releases). +To build from source, install [haskell stack](https://docs.haskellstack.org/en/stable/README/#how-to-install); on unix systems this is as simple as+ ``` wget -qO- https://get.haskellstack.org/ | sh ```@@ -42,7 +46,7 @@ To tweet from stderr, run a command that pipes stderr to stdin, i.e.  ```-YOUR_BUILD_COMMAND 2>&1 >/dev/null | tweet send+YOUR_BUILD_COMMAND 2>&1 >/dev/null | tweet input ```  The `tweet` executable reads from stdIn only, but you can view the options (replies, number of tweets to thread, etc.) with
− bash/example
@@ -1,1 +0,0 @@-stack install 2&>1 >/dev/null | tweet -c ~/.cred input -t3
clit.cabal view
@@ -1,5 +1,5 @@ name: clit-version: 0.4.0.1+version: 0.4.0.2 cabal-version: >=1.10 build-type: Simple license: BSD3@@ -17,7 +17,6 @@     README.md     stack.yaml     bash/mkCompletions-    bash/example  source-repository head     type: git@@ -65,7 +64,7 @@     main-is: Main.hs     build-depends:         base >=4.9.1.0 && <4.10,-        clit >=0.4.0.1 && <0.5+        clit >=0.4.0.2 && <0.5     default-language: Haskell2010     hs-source-dirs: app 
src/Web/Tweet/Utils.hs view
@@ -3,6 +3,7 @@  import qualified Data.ByteString.Char8 as BS import Text.Megaparsec.String+import Text.Megaparsec.Lexer as L import Text.Megaparsec import Data.Monoid import Data.Maybe@@ -61,13 +62,28 @@     string $ "\"" <> str <> "\":"     open <- optional $ char '\"'     let forbidden = if (isJust open) then "\\\"" else "\\\","-    want <- many $ noneOf forbidden <|> specialChar '\"' <|> specialChar '/' <|> specialChar 'n' <|> specialChar 'u'+    want <- many $ noneOf forbidden <|> specialChar '\"' <|> specialChar '/' <|> newlineChar <|> unicodeChar -- specialChar 'u'     pure want +newlineChar :: Parser Char+newlineChar = do+    string "\\n"+    pure '\n'++unicodeChar :: Parser Char+unicodeChar = do+    string "\\u"+    num <- fromHex <$> count 4 anyChar+    pure . toEnum . fromIntegral $ num+ specialChar :: Char -> Parser Char specialChar c = do     string $ "\\" ++ pure c-    if c /= '\n' then pure c else pure '\n'+    pure c++fromHex :: String -> Integer+fromHex = fromRight . (parse (L.hexadecimal :: Parser Integer) "")+    where fromRight (Right a) = a  -- | helper function to get the key as read from a file keyLinePie :: String -> String