git-brunch 1.0.3.0 → 1.0.4.0
raw patch · 3 files changed
+17/−14 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- git-brunch.cabal +2/−2
- src/Git.hs +4/−0
- src/GitBrunch.hs +11/−12
git-brunch.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 7c82c894fbea0ccfeedcbfed2d569c22a055ae960da4e1df61049777feaa0671+-- hash: 407ffbc23a3da9726721f4645e1dadf91411c6068242303a3995986f4191cd1c name: git-brunch-version: 1.0.3.0+version: 1.0.4.0 synopsis: git checkout command-line tool description: Please see the README on GitHub at <https://github.com/andys8/git-brunch#readme> category: Git
src/Git.hs view
@@ -14,11 +14,13 @@ | BranchCurrent String | BranchRemote String String + instance (Show Branch) where show (BranchLocal n ) = n show (BranchCurrent n ) = n <> "*" show (BranchRemote o n) = o <> "/" <> n + listBranches :: IO [Branch] listBranches = toBranches <$> execGitBranch where@@ -37,6 +39,7 @@ toBranches :: String -> [Branch] toBranches input = filter (not . isHead) $ toBranch <$> lines input + toBranch :: String -> Branch toBranch line = toBranch' $ head $ words $ drop 2 line where@@ -59,6 +62,7 @@ parseRemoteBranch :: String -> Branch parseRemoteBranch str = BranchRemote remote name where (remote, _ : name) = span ('/' /=) str+ --- Helper
src/GitBrunch.hs view
@@ -26,12 +26,12 @@ , str , vBox , hBox+ , padAll , padLeft- , withAttr , padRight+ , withAttr , withBorderStyle , (<+>)- , padAll ) import qualified Brick.Widgets.List as L import qualified Data.Vector as Vec@@ -75,16 +75,17 @@ , C.hCenter $ toBranchList remoteBranchesL ] , str " "- , vBox- [ drawInstruction "HJKL/arrows" "navigate"- , drawInstruction "Enter" "checkout"- , drawInstruction "Esc/Q" "exit"- ]+ , instructions ] ] where toBranchList lens' = state ^. lens' & (\l -> drawBranchList (hasFocus l) l)- hasFocus = (_focus state ==) . L.listName+ hasFocus = (_focus state ==) . L.listName+ instructions = C.hCenter $ hLimit 100 $ hBox+ [ drawInstruction "HJKL/arrows" "navigate"+ , drawInstruction "Enter" "checkout"+ , drawInstruction "Esc/Q" "exit"+ ] drawBranchList :: Bool -> L.List Name Branch -> Widget Name@@ -109,12 +110,10 @@ drawInstruction :: String -> String -> Widget n drawInstruction keys action =- C.hCenter- $ str "Press "- <+> withAttr "key" (str keys)+ withAttr "key" (str keys) <+> str " to " <+> withAttr "bold" (str action)- <+> str "."+ & C.hCenter appHandleEvent :: State -> T.BrickEvent Name e -> T.EventM Name (T.Next State)