Permalink
Browse files

More code stubs while adding cmd args support (rudimentary)

  • Loading branch information...
1 parent d5f5b42 commit f489f578a74afd3c087a3e15407e4aaa62bc2eba Mihai Maruseac committed Feb 10, 2011
Showing with 72 additions and 0 deletions.
  1. +13 −0 src/HaCoTeB.hs
  2. +33 −0 src/HaCoTeB/Options.hs
  3. +8 −0 src/HaCoTeB/Splitter.hs
  4. +18 −0 src/Main.hs
View
@@ -0,0 +1,13 @@
+{-
+This is an umbrella module reexporting the HaCoTeB.* submodules to allow a
+more simple import in other programs using this module (if any).
+-}
+
+module HaCoTeB
+ ( module HaCoTeB.Options
+ , module HaCoTeB.Splitter
+ ) where
+
+import HaCoTeB.Options
+import HaCoTeB.Splitter
+
View
@@ -0,0 +1,33 @@
+{-
+This module contains the command line arguments that can be given to HaCoTeB.
+If someone will want to extend them for another project which uses HaCoTeB she
+can freely do so either here or by importing this module and constructing a
+more general CmdArgs data type structure.
+-}
+
+{-# LANGUAGE DeriveDataTypeable #-}
+
+module HaCoTeB.Options
+ where
+
+import System.Console.CmdArgs
+
+{-
+Command line arguments as a data type.
+-}
+data Options = Options
+ { files :: [FilePath]
+ } deriving (Show, Data, Typeable)
+
+{-
+Command line arguments for the entire HaCoTeB (all stages of pipeline).
+-}
+options = Options
+ { files = def &= args &= typ "FILES"
+ }
+ &= summary "HaCoTeB (C) Mihai Maruseac 2011"
+ &= help ("Constructs one simple output file from an input file containing"
+ ++ " text and code markup. Useful for blogging or other activities.")
+ &= details ["Details: TODO"]
+ &= program "hctb"
+
View
@@ -0,0 +1,8 @@
+{-
+This module contains the splitting part of the HaCoTeB project.
+-}
+
+module HaCoTeB.Splitter where
+
+test = 42
+
View
@@ -0,0 +1,18 @@
+{-
+This is the Main module for the HaCoTeB project. It is separated from the
+HaCoTeB module to allow for later reuse and to differentiate between the tool
+and its usage.
+-}
+
+{-# LANGUAGE RecordWildCards #-}
+
+module Main where
+
+import System.Console.CmdArgs
+
+import HaCoTeB
+
+main = do
+ Options {..} <- cmdArgs options -- as defined in HaCoTeB.Options
+ print files
+

0 comments on commit f489f57

Please sign in to comment.