Skip to content

Commit

Permalink
ENH Add --verbose flag to --check-install mode
Browse files Browse the repository at this point in the history
  • Loading branch information
luispedro committed Jan 3, 2019
1 parent bb555a6 commit 87f0539
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Version 0.10.0+
* Update to LTS-13 (GHC 8.6)
* Fix bug with orf_find & prots_out argument
* Call bwa/minimap2 with interleaved fastq files
* Add --verbose flag to check-install mode

Version 0.10.0 2018-11-12 by luispedro
* Fix to lock1's return value when used with paths (#68 - reopen)
Expand Down
17 changes: 11 additions & 6 deletions Execs/Main.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE PackageImports #-}
{- Copyright 2013-2018 NGLess Authors
{- Copyright 2013-2019 NGLess Authors
- License: MIT
-}
module Main
Expand Down Expand Up @@ -342,11 +342,16 @@ modeExec (PrintPathMode exec) = runNGLessIO "finding internal path" $ do
_ -> throwSystemError ("Unknown binary " ++ exec ++ ".")
liftIO $ putStrLn path

modeExec CheckInstallMode = runNGLessIO "Checking install" $ do
void samtoolsBin
void prodigalBin
void megahitBin
void bwaBin
modeExec (CheckInstallMode verbose) = runNGLessIO "Checking install" $ do
let checkPath tool pathA
| verbose = do
path <- pathA
liftIO $ putStrLn (tool ++ ": `" ++ path ++ "`")
| otherwise = void pathA
checkPath "samtools" samtoolsBin
checkPath "prodigal" prodigalBin
checkPath "megahit" megahitBin
checkPath "bwa" bwaBin
liftIO $ putStrLn "Install OK"

main' = do
Expand Down
5 changes: 4 additions & 1 deletion NGLess/CmdArgs.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE DeriveDataTypeable #-}
{- Copyright 2015-2017 NGLess Authors
{- Copyright 2015-2019 NGLess Authors
- License: MIT
-}
module CmdArgs
Expand Down Expand Up @@ -98,6 +98,8 @@ data NGLessMode =
{ pathDesired :: String
}
| CheckInstallMode
{ checkInstallVerbose :: Bool
}
deriving (Eq, Show)

parseVerbosity = option (eitherReader readVerbosity) (long "verbosity" <> short 'v' <> value Normal)
Expand Down Expand Up @@ -183,6 +185,7 @@ printPathArgs = flag' PrintPathMode (long "print-path")
<*> strArgument (metavar "EXEC")

checkInstallArgs = flag' CheckInstallMode (long "check-install" <> help "Check if ngless is correctly installed")
<*> switch (long "verbose" <> short 'v' <> help "Print paths")

nglessArgs :: Parser NGLessArgs
nglessArgs = NGLessArgs
Expand Down

0 comments on commit 87f0539

Please sign in to comment.