align-text 0.1.0.0 → 0.1.0.1
raw patch · 3 files changed
+24/−21 lines, 3 filesdep ~optparse-applicative
Dependency ranges changed: optparse-applicative
Files
- Main.hs +6/−2
- README.md +16/−17
- align-text.cabal +2/−2
Main.hs view
@@ -10,6 +10,8 @@ import Data.Monoid import Options.Applicative +-- IN PROGRESS: TODO implement startAtColumn+ data Options = Options { matchMode :: MatchMode , matchStrings :: [Text]@@ -56,8 +58,10 @@ -- and one if it doesn't splitOn :: Text -> Text -> [Text] splitOn alignString input =+ -- breakOn "::" "a::b::c" ==> ("a", "::b::c")+ -- breakOn "/" "foobar" ==> ("foobar", "") let (x,y) = T.breakOn alignString input- in [z | z <- [x, trim alignString y], z /= mempty]+ in [z | z <- [T.stripEnd x, y], z /= mempty] -- | Makes column cells in a column the same width -- Used for the standard Series mode.@@ -66,7 +70,7 @@ map maybeAdjust xs where maxWidth = maximum $ map (T.length . T.stripEnd) $ xs maybeAdjust :: Text -> Text- maybeAdjust cell = T.justifyLeft maxWidth ' ' . T.stripEnd $ cell+ maybeAdjust cell = (T.justifyLeft maxWidth ' ' . T.stripEnd $ cell) <> " " alignOnAlteratives :: [Text] -> [Text] -> [Text] alignOnAlteratives alts lines =
README.md view
@@ -6,11 +6,25 @@ align lines of code neatly on programming language operators like =>, ::, @=?, =, +, etc. +## Installation++You must first have the Haskll platform installed on your system:++* [Haskell platform](https://www.haskell.org/platform)++```+cabal update+cabal install align-text+```++This will likely install the `align` executable in ~/.cabal/bin, which should be on your PATH.++ ## Usage -`align` has two modes: Series mode and Alternative mode.+`align` has two modes: Serial mode and Alternative mode. -### Series mode+### Serial mode Assume you want to align this text: @@ -100,21 +114,6 @@ vnoremap <leader>H :AlignHaskellTest<cr> ```--## Installation--You must first have the Haskll platform installed on your system:--* [Haskell platform](https://www.haskell.org/platform)--`git clone` this project to a local directory. Then from that directory, -run this command:--```-cabal install-```--This will likely install the `align` executable in ~/.cabal/bin, which should be on your PATH. ## Author
align-text.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: align-text-version: 0.1.0.0+version: 0.1.0.1 synopsis: A simple unix filter to align text on specified substrings description: A simple unix filter to align text on specified substrings homepage: https://github.com/danchoi/align-text@@ -22,6 +22,6 @@ -- other-extensions: build-depends: base >=4.7 && <4.8 , text- , optparse-applicative+ , optparse-applicative == 0.11.0.1 -- hs-source-dirs: default-language: Haskell2010