diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-06-17 05:47:27 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-06-17 05:47:27 +0300 |
commit | db5affcc2c1dd96562556034179c405d3c38b2c5 (patch) | |
tree | e814ee50cedcaa94a079b6efb7aa65b4d76a975f /app/AddPath.hs | |
parent | bump resolver (diff) | |
download | windows-env-db5affcc2c1dd96562556034179c405d3c38b2c5.tar.gz windows-env-db5affcc2c1dd96562556034179c405d3c38b2c5.zip |
add --version flag to executables
Diffstat (limited to 'app/AddPath.hs')
-rw-r--r-- | app/AddPath.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/AddPath.hs b/app/AddPath.hs index cf8aa7c..3e8bbd8 100644 --- a/app/AddPath.hs +++ b/app/AddPath.hs @@ -9,12 +9,14 @@ module Main (main) where import Control.Monad (when, void) import Control.Monad.Trans.Except (catchE, runExceptT, throwE) -import Data.Monoid ((<>)) import Data.List (nub) +import Data.Monoid ((<>)) +import Data.Version (showVersion) import System.IO.Error (ioError, isDoesNotExistError) import Options.Applicative +import qualified Paths_windows_env as Meta import qualified WindowsEnv import Utils.Path @@ -57,8 +59,13 @@ optionParser = Options main :: IO () main = execParser parser >>= addPath where - parser = info (helper <*> optionParser) $ - fullDesc <> progDesc "Add directories to your PATH" + parser = info (helper <*> versioner <*> optionParser) + $ fullDesc + <> progDesc "Add directories to your PATH" + versioner = infoOption (showVersion Meta.version) + $ long "version" + <> help "Show version" + <> hidden addPath :: Options -> IO () addPath options = runExceptT doAddPath >>= either ioError return |