Permalink
Browse files

Implement passing of gnuplot options.

This just passes on "set KEY VALUE" type commands to gnuplot
  • Loading branch information...
1 parent 192c205 commit acb3a6fa2a73a2a779e3010bd1ef2c55e177cd5f @alang9 committed Oct 19, 2011
Showing with 8 additions and 3 deletions.
  1. +8 −3 tools/zoom-cache-gnuplot.hs
View
11 tools/zoom-cache-gnuplot.hs
@@ -2,6 +2,7 @@ module Main (
main
) where
+import Data.Maybe (fromMaybe)
import System.Environment (getArgs)
import System.Console.GetOpt
@@ -40,12 +41,16 @@ defaultOptions = Options
parseCustom :: String -> Attribute
parseCustom s =
- Custom s1 [s2]
- where (s1, s2) = break (=='=') s
+ Custom s1 [tail s2]
+ where (s1, s2) = break (==':') s
options :: [OptDescr (Options -> Options)]
options =
- []
+ [ Option ['g'] ["gnuplot"]
+ (OptArg ((\ f opts -> opts { gnuplotOpts = parseCustom f : gnuplotOpts opts }) . fromMaybe "gnuplot")
+ "KEY:VALUE")
+ "gnuplot KEY:VALUE"
+ ]
parseOpts :: [String] -> IO (Options, [String])
parseOpts argv =

0 comments on commit acb3a6f

Please sign in to comment.