codex 0.0.1.3 → 0.0.1.4
raw patch · 2 files changed
+21/−4 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- codex.cabal +4/−2
- src/Main.hs +17/−2
codex.cabal view
@@ -1,12 +1,14 @@ name: codex-version: 0.0.1.3-synopsis: Code Explorer for Cabal+version: 0.0.1.4+synopsis: A ctags file generator for cabal project dependencies. description: This tool download and cache the source code of packages in your local hackage, he can then use this cache to generate `tags` files aggregating the sources of all the dependencies of your cabal projects. . You basically do `codex update` in your cabal project directory and you'll get a `codex.tags` file that you can use in your favorite text editor.+ .+ Usage overview can be found in the <http://github.com/aloiscochard/codex#codex README>. homepage: http://github.com/aloiscochard/codex license: OtherLicense
src/Main.hs view
@@ -17,6 +17,7 @@ import System.Directory import System.Environment import System.FilePath+import System.Exit import qualified Data.List as List @@ -59,7 +60,6 @@ resolve Nothing = putStrLn "No cabal file found." resolve (Just project) = do dependencies <- fmap (\db -> resolveDependencies db project) readHackage- traverse (putStrLn . show . identifier) dependencies shouldUpdate <- runEitherT . isUpdateRequired tagsFile $ fmap identifier dependencies when (either (const True) id shouldUpdate || force) $ do fileExist <- doesFileExist tagsFile@@ -77,6 +77,17 @@ res <- runEitherT $ assembly cx (fmap identifier xs) tagsFile either (putStrLn . show) (const $ return ()) res +help :: IO ()+help = putStrLn $+ unlines [ "Usage: codex [update] [cache clean] [set tagger [hasktags|ctags]]"+ , " [--help]"+ , ""+ , " update Synchronize the `codex.tags` file in the current cabal project directory"+ , " cache clean Remove all `tags` file from the local hackage cache]"+ , " set tagger <tagger> Update the `~/.codex` configuration file for the given tagger (hasktags|ctags)."+ , ""+ , "By default `hasktags` will be used, and need to be in the `PATH`, the tagger command can be fully customized in `~/.codex`." ]+ main :: IO () main = do cx <- loadConfig@@ -87,7 +98,11 @@ run cx ["update", "--force"] = update cx True run cx ["set", "tagger", "ctags"] = encodeConfig $ cx { tagsCmd = taggerCmd Ctags } run cx ["set", "tagger", "hasktags"] = encodeConfig $ cx { tagsCmd = taggerCmd Hasktags }- run cx _ = putStrLn "Usage: codex [update|cache clean|set tagger [ctags|hasktags]]"+ run cx ["--help"] = help+ run cx [] = help+ run cx (x:_) = do+ putStrLn $ concat ["codex: '", x,"' is not a codex command. See 'codex --help'."]+ exitWith (ExitFailure 1) loadConfig :: IO Codex loadConfig = decodeConfig >>= maybe defaultConfig return where