add fields to git-annex-shell

This commit is contained in:
Joey Hess 2012-07-02 00:53:00 -04:00
parent 2d2bfe9809
commit d1f49b0ad0
5 changed files with 42 additions and 12 deletions

View file

@ -35,3 +35,13 @@ separate c l = unbreak $ break c l
{- Breaks out the first line. -}
firstLine :: String-> String
firstLine = takeWhile (/= '\n')
{- Splits a list into segments that are delimited by items matching
- a predicate. (The delimiters are not included in the segments.) -}
segment :: (a -> Bool) -> [a] -> [[a]]
segment p l = map reverse $ go [] [] l
where
go c r [] = reverse $ c:r
go c r (i:is)
| p i = go [] (c:r) is
| otherwise = go (i:c) r is