-----------------------------------------------------------------------------
-- |
-- Module : CmdParams
-- Copyright : (C) Peter Robinson 2010-2013
-- License : GPL-2
--
-- Maintainer : Peter Robinson <thaldyron@gmail.com>
-- Stability : experimental
-- Portability : portable
--
-- Contains the command line parameter definitions.
--
-----------------------------------------------------------------------------
module CmdParams
where
import System.Console.CmdArgs
data OutputFile = FileSVG | FilePDF | FilePNG
deriving(Eq,Data,Typeable)
instance Show OutputFile where
show FileSVG = ".svg"
show FilePDF = ".pdf"
show FilePNG = ".png"
outputFileToGraphviz :: OutputFile -> String
outputFileToGraphviz FileSVG = " -Tsvg "
outputFileToGraphviz FilePDF = " -Tpdf "
outputFileToGraphviz FilePNG = " -Tpng "
instance Default OutputFile where
def = FilePDF
-- | Command line arguments:
data MathGenealogy = MathGenealogy
{ prefix :: String
, keepDotFile :: Bool
, graphvizArgs :: String
-- , onlyDotFile :: Bool
, verbose :: Bool
, includeTheses :: Bool
, startURL :: String
, outputFile :: OutputFile
, font :: String
, fontHeading :: String
, fontSize :: Double
, fontSizeHeading :: Double
, fontSizeFirst :: Double
, fontSizeFirstHeading:: Double
, nodeBackgroundColor :: String
, edgeColor :: String
, oldTextLabels :: Bool
}
deriving(Eq,Data,Typeable,Show)
mathGenealogy :: MathGenealogy
mathGenealogy = MathGenealogy
{ startURL = def &= args &= typ "URL"
, prefix = "output" &= typ "PREFIX"
, keepDotFile = False
, graphvizArgs = " -Gcharset=utf8 " &= typ "<graphviz parameters>" -- &= opt " -Gcharset=utf8 "
-- , onlyDotFile = False &= help "Only create a GraphViz '.dot' file."
, verbose = False &= help "Print data to terminal."
, includeTheses= False &= help "Include PhD thesis in output"
, outputFile = enum [ FileSVG &= help "create SVG file (default - best supported by GraphViz; use this if you run into issues.)"
, FilePDF &= help "create PDF file"
, FilePNG &= help "create PNG file"
]
, font = "Helvetica" &= help "Fonts included with GraphViz (see http://www.graphviz.org/doc/fontfaq.txt): AvantGarde-Book AvantGarde-BookOblique AvantGarde-Demi AvantGarde-DemiOblique Bookman-Demi Bookman-DemiItalic Bookman-Light Bookman-LightItalic Courier Courier-Bold Courier-BoldOblique Courier-Oblique Helvetica Helvetica-Bold Helvetica-BoldOblique Helvetica-Narrow Helvetica-Narrow-Bold Helvetica-Narrow-BoldOblique Helvetica-Narrow-Oblique Helvetica-Oblique NewCenturySchlbk-Bold NewCenturySchlbk-BoldItalic NewCenturySchlbk-Italic NewCenturySchlbk-Roman Palatino-Bold Palatino-BoldItalic Palatino-Italic Palatino-Roman Symbol Times-Bold Times-BoldItalic Times-Italic Times-Roman ZapfChancery-MediumItalic ZapfDingbats "
, fontSize = 12 &= help "Font size of the additional information of all entries except the first one."
, fontHeading = "Helvetica" &= help "Font used for names"
, fontSizeHeading = 16 &= help "Font size used for names"
, fontSizeFirstHeading = 20 &= help "Font size of first entry."
, fontSizeFirst = 16 &= help "Font size of first entry."
, nodeBackgroundColor = "LightBlue1" &= help "Node background color. See http://hackage.haskell.org/packages/archive/graphviz/2999.15.0.1/doc/html/Data-GraphViz-Attributes-Colors-X11.html"
, edgeColor = "Gray" &= help "Edge color. See http://hackage.haskell.org/packages/archive/graphviz/2999.15.0.1/doc/html/Data-GraphViz-Attributes-Colors-X11.html"
, oldTextLabels = False &= help "Fall back to non-HTML text labels. Use this if you are having issues with the rendering of the HTML-like labels. Note that all font parameters except 'font', 'fontsize', and 'fontsizefirst' are ignored with this setting."
} &= summary "Mathematics Genealogy Visualizer (C) 2010-2013 Peter Robinson thaldyron@gmail.com"
&= details[ "Run the program with a start-URL, for example:"
,"# mathgenealogy http://genealogy.math.ndsu.nodak.edu/id.php?id=18231"
,"Disclaimer: This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License (version 2) for full details."
]