hgrev: Compile Mercurial (hg) version info into Haskell code

[ bsd3, development, library ] [ Propose Tags ] [ Report a vulnerability ]
Overview

hgrev provides two modules:

  • Development.HgRev - Mercurial (hg) Haskell API

  • Development.HgRev.TH - Template Haskell splice to compile version info into Haskell code

Use $(hgRevStateTH defFormat) with Template Haskell enabled to insert the formatted version string.

Requirements

hgrev requires the hg binary version 3.2 or greater is installed and available on the system. Development.HgRev.HgRev and Development.HgRev.HgState are obtained via two separate calls to hg because working directory state isn't available programmatically.

Usage Example
module Example where

import           Data.Monoid          ((<>))
import           Data.Text            (Text, pack)
import           Development.HgRev.TH (defFormat, hgRevStateTH, jsonFormat)
import           Options.Applicative  (Parser, ParserInfo, execParser, fullDesc,
                                       help, helper, info, infoOption, long,
                                       progDesc, short)

main :: IO ()
main = execParser parserInfo >> return ()

verSwitch :: Parser (a -> a)
verSwitch =
    infoOption ("HG rev: " <> $(hgRevStateTH defFormat))
    $  long "version"
    <> short 'v'
    <> help "Display version information"

jsonSwitch :: Parser (a -> a)
jsonSwitch =
    infoOption $(hgRevStateTH jsonFormat)
    $  long "json"
    <> short 'J'
    <> help "Display JSON version information"

parserInfo :: ParserInfo (a -> a)
parserInfo = info (helper <*> verSwitch <* jsonSwitch) fullDesc

Check out the gitrev package for similar git functionality.


[Skip to Readme]

Modules

[Last Documentation]

  • Development
    • Development.HgRev
      • Development.HgRev.TH

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6
Dependencies aeson (>=0.8 && <0.11), base (>=4.7 && <4.9), bytestring (>=0.10 && <0.11), directory (>=1.2 && <1.3), filepath (>=1.4 && <1.5), process (>=1.2 && <1.4), template-haskell (>=2.10 && <2.11) [details]
License MIT
Author Luke Hoersten
Maintainer luke@hoersten.org
Category Development
Home page https://github.com/LukeHoersten/hgrev
Bug tracker https://github.com/LukeHoersten/hgrev/issues
Source repo head: git clone git://github.com/LukeHoersten/hgrev.git
Uploaded by LukeHoersten at 2015-12-07T20:26:38Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 8348 total (44 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-11-29 [all 2 reports]

Readme for hgrev-0.1.5

[back to package description]

HgRev

Compile Mercurial (hg) version info into Haskell code

Overview

hgrev provides two modules:

  • Development.HgRev - Mercurial (hg) Haskell API
  • Development.HgRev.TH - Template Haskell splice to compile version info into Haskell code

Use $(hgRevStateTH defFormat) with Template Haskell enabled to insert the formatted version string.

Requirements

hgrev requires the hg binary version 3.2 or greater is installed and available on the system. Development.HgRev.HgRev and Development.HgRev.HgState are obtained via two separate calls to hg because working directory state isn't available programmatically.

Usage Example

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell   #-}

module Example where

import           Data.Monoid          ((<>))
import           Data.Text            (Text, pack)
import           Development.HgRev.TH (defFormat, hgRevStateTH, jsonFormat)
import           Options.Applicative  (Parser, ParserInfo, execParser, fullDesc,
                                        help, helper, info, infoOption, long,
                                        progDesc, short)

main :: IO ()
main = execParser parserInfo >> return ()

verSwitch :: Parser (a -> a)
verSwitch =
    infoOption ("HG rev: " <> $(hgRevStateTH defFormat))
    $  long "version"
    <> short 'v'
    <> help "Display version information"

jsonSwitch :: Parser (a -> a)
jsonSwitch =
    infoOption $(hgRevStateTH jsonFormat)
    $  long "json"
    <> short 'J'
    <> help "Display JSON version information"

parserInfo :: ParserInfo (a -> a)
parserInfo = info (helper <*> verSwitch <* jsonSwitch) fullDesc

Check out the gitrev package for similar git functionality.