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/RemovePath.hs | |
parent | bump resolver (diff) | |
download | windows-env-db5affcc2c1dd96562556034179c405d3c38b2c5.tar.gz windows-env-db5affcc2c1dd96562556034179c405d3c38b2c5.zip |
add --version flag to executables
Diffstat (limited to '')
-rw-r--r-- | app/RemovePath.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/RemovePath.hs b/app/RemovePath.hs index ed29f3a..6954359 100644 --- a/app/RemovePath.hs +++ b/app/RemovePath.hs @@ -10,10 +10,12 @@ module Main (main) where import Control.Monad (void, when) import Control.Monad.Trans.Except (catchE, runExceptT, throwE) 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.Prompt @@ -50,8 +52,13 @@ optionParser = Options main :: IO () main = execParser parser >>= removePath where - parser = info (helper <*> optionParser) $ - fullDesc <> progDesc "Remove directories from your PATH" + parser = info (helper <*> versioner <*> optionParser) + $ fullDesc + <> progDesc "Remove directories from your PATH" + versioner = infoOption (showVersion Meta.version) + $ long "version" + <> help "Show version" + <> hidden removePath :: Options -> IO () removePath options = runExceptT doRemovePath >>= either ioError return |