aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app/ListPaths.hs
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-06-17 05:47:27 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-06-17 05:47:27 +0300
commitdb5affcc2c1dd96562556034179c405d3c38b2c5 (patch)
treee814ee50cedcaa94a079b6efb7aa65b4d76a975f /app/ListPaths.hs
parentbump resolver (diff)
downloadwindows-env-db5affcc2c1dd96562556034179c405d3c38b2c5.tar.gz
windows-env-db5affcc2c1dd96562556034179c405d3c38b2c5.zip
add --version flag to executables
Diffstat (limited to '')
-rw-r--r--app/ListPaths.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/ListPaths.hs b/app/ListPaths.hs
index e075f9f..b7d9c37 100644
--- a/app/ListPaths.hs
+++ b/app/ListPaths.hs
@@ -12,12 +12,14 @@ import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Except (runExceptT)
import Data.Maybe (fromMaybe)
import Data.Monoid ((<>))
+import Data.Version (showVersion)
import System.Directory (doesDirectoryExist)
import System.Environment (lookupEnv)
import System.IO.Error (ioError)
import Options.Applicative
+import qualified Paths_windows_env as Meta
import qualified WindowsEnv
import Utils.Path
@@ -63,8 +65,13 @@ optionParser = Options
main :: IO ()
main = execParser parser >>= listPaths
where
- parser = info (helper <*> optionParser) $
- fullDesc <> progDesc "List directories in your PATH"
+ parser = info (helper <*> versioner <*> optionParser)
+ $ fullDesc
+ <> progDesc "List directories in your PATH"
+ versioner = infoOption (showVersion Meta.version)
+ $ long "version"
+ <> help "Show version"
+ <> hidden
listPaths :: Options -> IO ()
listPaths options = runExceptT doListPaths >>= either ioError return