log --raw-date: Use to display seconds from unix epoch.
This commit is contained in:
parent
1d848a45d2
commit
fb656b9048
5 changed files with 26 additions and 5 deletions
|
@ -44,6 +44,7 @@ cmd = withGlobalOptions annexedMatchingOptions $
|
|||
|
||||
data LogOptions = LogOptions
|
||||
{ logFiles :: CmdParams
|
||||
, rawDateOption :: Bool
|
||||
, gourceOption :: Bool
|
||||
, passthruOptions :: [CommandParam]
|
||||
}
|
||||
|
@ -51,6 +52,10 @@ data LogOptions = LogOptions
|
|||
optParser :: CmdParamsDesc -> Parser LogOptions
|
||||
optParser desc = LogOptions
|
||||
<$> cmdParams desc
|
||||
<*> switch
|
||||
( long "raw-date"
|
||||
<> help "display seconds from unix epoch"
|
||||
)
|
||||
<*> switch
|
||||
( long "gource"
|
||||
<> help "format output for gource"
|
||||
|
@ -92,8 +97,9 @@ start m zone o file key = do
|
|||
stop
|
||||
where
|
||||
output
|
||||
| (gourceOption o) = gourceOutput lookupdescription file
|
||||
| otherwise = normalOutput lookupdescription file zone
|
||||
| rawDateOption o = normalOutput lookupdescription file show
|
||||
| gourceOption o = gourceOutput lookupdescription file
|
||||
| otherwise = normalOutput lookupdescription file (showTimeStamp zone)
|
||||
lookupdescription u = fromMaybe (fromUUID u) $ M.lookup u m
|
||||
|
||||
showLog :: Outputter -> [RefChange] -> Annex ()
|
||||
|
@ -109,11 +115,11 @@ showLog outputter ps = do
|
|||
get ref = map toUUID . Logs.Presence.getLog . L.unpack <$>
|
||||
catObject ref
|
||||
|
||||
normalOutput :: (UUID -> String) -> FilePath -> TimeZone -> Outputter
|
||||
normalOutput lookupdescription file zone present ts us =
|
||||
normalOutput :: (UUID -> String) -> FilePath -> (POSIXTime -> String) -> Outputter
|
||||
normalOutput lookupdescription file formattime present ts us =
|
||||
liftIO $ mapM_ (putStrLn . format) us
|
||||
where
|
||||
time = showTimeStamp zone ts
|
||||
time = formattime ts
|
||||
addel = if present then "+" else "-"
|
||||
format u = unwords [ addel, time, file, "|",
|
||||
fromUUID u ++ " -- " ++ lookupdescription u ]
|
||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -3,6 +3,7 @@ git-annex (6.20160319) UNRELEASED; urgency=medium
|
|||
* ddar remote: fix ssh calls
|
||||
Thanks, Robie Basak
|
||||
* log: Display time with time zone.
|
||||
* log --raw-date: Use to display seconds from unix epoch.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Wed, 23 Mar 2016 11:42:36 -0400
|
||||
|
||||
|
|
|
@ -20,6 +20,11 @@ showing each repository they were added to ("+") and removed from ("-").
|
|||
|
||||
For example: `--since "1 month ago"`
|
||||
|
||||
* `--raw-date`
|
||||
|
||||
Rather than the normal display of a date in the local time zone,
|
||||
displays seconds since the unix epoch.
|
||||
|
||||
* `--gource`
|
||||
|
||||
Generates output suitable for the `gource` visualization program.
|
||||
|
|
|
@ -12,3 +12,4 @@ If the timestamp were in Unix time, it would be easier to process in a mechanica
|
|||
+ 1414368018 ev-2014.pdf | 50083bd6-7e20-4356-a32f-a1dde07de441 -- penn
|
||||
```
|
||||
|
||||
> [[done]] --[[Joey]]
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 1"""
|
||||
date="2016-03-29T18:35:26Z"
|
||||
content="""
|
||||
I don't think that's a good default, but I will add the time zone to the
|
||||
date displayed. And add a --raw-date option for epoch.
|
||||
"""]]
|
Loading…
Add table
Reference in a new issue