log --max-count=n
This commit is contained in:
parent
078788a9e7
commit
3c88d57399
1 changed files with 13 additions and 7 deletions
|
@ -26,23 +26,29 @@ import qualified Remote
|
||||||
import qualified Option
|
import qualified Option
|
||||||
|
|
||||||
def :: [Command]
|
def :: [Command]
|
||||||
def = [withOptions [afterOption] $
|
def = [withOptions [afterOption, maxcountOption] $
|
||||||
command "log" paramPaths seek "shows location log"]
|
command "log" paramPaths seek "shows location log"]
|
||||||
|
|
||||||
afterOption :: Option
|
afterOption :: Option
|
||||||
afterOption = Option.field [] "after" paramDate "show log after date"
|
afterOption = Option.field [] "after" paramDate "show log after date"
|
||||||
|
|
||||||
|
maxcountOption :: Option
|
||||||
|
maxcountOption = Option.field ['n'] "max-count" paramNumber "limit number of logs displayed"
|
||||||
|
|
||||||
seek :: [CommandSeek]
|
seek :: [CommandSeek]
|
||||||
seek = [withField afterOption return $ \afteropt ->
|
seek = [withField afterOption return $ \afteropt ->
|
||||||
withFilesInGit $ whenAnnexed $ start afteropt]
|
withField maxcountOption return $ \maxcount ->
|
||||||
|
withFilesInGit $ whenAnnexed $ start afteropt maxcount]
|
||||||
|
|
||||||
start :: Maybe String -> FilePath -> (Key, Backend) -> CommandStart
|
start :: Maybe String -> Maybe String -> FilePath -> (Key, Backend) -> CommandStart
|
||||||
start afteropt file (key, _) = do
|
start afteropt maxcount file (key, _) = do
|
||||||
let ps = case afteropt of
|
|
||||||
Nothing -> []
|
|
||||||
Just date -> [Param "--after", Param date]
|
|
||||||
showLog file =<< (readLog <$> getLog key ps)
|
showLog file =<< (readLog <$> getLog key ps)
|
||||||
stop
|
stop
|
||||||
|
where
|
||||||
|
ps = concatMap (\(o, p) -> maybe [] p o)
|
||||||
|
[ (afteropt, \d -> [Param "--after", Param d])
|
||||||
|
, (maxcount, \c -> [Param "--max-count", Param c])
|
||||||
|
]
|
||||||
|
|
||||||
showLog :: FilePath -> [(POSIXTime, (Git.Ref, Git.Ref))] -> Annex ()
|
showLog :: FilePath -> [(POSIXTime, (Git.Ref, Git.Ref))] -> Annex ()
|
||||||
showLog file ps = do
|
showLog file ps = do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue