hi 1.1.0.3 → 1.2.0.0
raw patch · 5 files changed
+10/−5 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Hi.CommandLineOption: directoryName :: CommandLineOption -> Maybe String
+ Hi.Types: directoryName :: Option -> String
- Hi.CommandLineOption: CommandLineOption :: String -> Maybe String -> Maybe String -> Maybe String -> String -> Maybe String -> Bool -> Maybe String -> CommandLineOption
+ Hi.CommandLineOption: CommandLineOption :: String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> String -> Maybe String -> Bool -> Maybe String -> CommandLineOption
- Hi.Types: Option :: String -> String -> String -> String -> String -> TemplateSource -> [String] -> Option
+ Hi.Types: Option :: String -> String -> String -> String -> String -> String -> TemplateSource -> [String] -> Option
Files
- hi.cabal +1/−1
- src/Hi.hs +3/−3
- src/Hi/CommandLineOption.hs +2/−0
- src/Hi/Option.hs +3/−1
- src/Hi/Types.hs +1/−0
hi.cabal view
@@ -1,5 +1,5 @@ name: hi-version: 1.1.0.3+version: 1.2.0.0 cabal-version: >=1.8 build-type: Simple license: BSD3
src/Hi.hs view
@@ -67,7 +67,7 @@ where go (TemplateFile path content) = TemplateFile (rewritePath' path) (substitute' content) go (RegularFile path content) = RegularFile (rewritePath' path) content- rewritePath' path = joinPath $ packageName : splitPath (rewritePath packageName moduleName path)+ rewritePath' path = joinPath $ directoryName : splitPath (rewritePath packageName moduleName path) substitute' text = BS.concat . LBS.toChunks . encodeUtf8 $ substitute (decodeUtf8 text) (context options) options = [("packageName", packageName)@@ -83,8 +83,8 @@ context opts x = let x' = T.unpack x in T.pack . (fromMaybe ("$" ++ x')) $ lookup x' opts postProcess :: Option -> IO ()-postProcess Option {packageName, afterCommands} = do- void $ inDirectory packageName $ forM_ afterCommands (void . system)+postProcess Option {directoryName, afterCommands} = do+ void $ inDirectory directoryName $ forM_ afterCommands (void . system) -- | Drop 'RegularFile's if there is a 'TemplateFile' which has same name --
src/Hi/CommandLineOption.hs view
@@ -9,6 +9,7 @@ data CommandLineOption = CommandLineOption { packageName :: String , moduleName :: Maybe String+ , directoryName :: Maybe String , author :: Maybe String , email :: Maybe String , repository :: String@@ -23,6 +24,7 @@ -- TODO: Deprecate and remove "moduleName" option -- https://github.com/fujimura/hi/issues/48 <*> optional (strOption (short 'm' <> long "moduleName" <> long "module-name" <> help "Name of Module"))+ <*> optional (strOption (short 'd' <> long "directory-name" <> help "Directory name to create files")) <*> optional (strOption (short 'a' <> long "author" <> help "Name of the project's author")) <*> optional (strOption (short 'e' <> long "email" <> help "Email address of the maintainer")) <*> strOption (short 'r' <> long "repository" <> help "Template repository" <> value defaultRepo)
src/Hi/Option.hs view
@@ -31,8 +31,10 @@ afterCommands = catMaybes [ mGitInit , CommandLineOption.afterCommand copt ]+ packageName = CommandLineOption.packageName copt return Option { moduleName = fromMaybe moduleName $ CommandLineOption.moduleName copt- , packageName = CommandLineOption.packageName copt+ , packageName = packageName+ , directoryName = fromMaybe packageName $ CommandLineOption.directoryName copt , author = author , email = email , templateSource = FromRepo $ CommandLineOption.repository copt
src/Hi/Types.hs view
@@ -19,6 +19,7 @@ data Option = Option { moduleName :: String , packageName :: String+ , directoryName :: String , author :: String , email :: String , year :: String