aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/AddPath.hs13
-rw-r--r--app/ListPaths.hs11
-rw-r--r--app/RemovePath.hs11
-rw-r--r--app/SetEnv.hs11
-rw-r--r--app/UnsetEnv.hs11
5 files changed, 46 insertions, 11 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
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
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
diff --git a/app/SetEnv.hs b/app/SetEnv.hs
index 6c941af..ac8fa93 100644
--- a/app/SetEnv.hs
+++ b/app/SetEnv.hs
@@ -10,10 +10,12 @@ module Main (main) where
import Control.Monad (void)
import Control.Monad.Trans.Except (runExceptT)
import Data.Monoid ((<>))
+import Data.Version (showVersion)
import System.IO.Error (ioError)
import Options.Applicative
+import qualified Paths_windows_env as Meta
import qualified WindowsEnv
import Utils.Prompt
@@ -49,8 +51,13 @@ optionParser = Options
main :: IO ()
main = execParser parser >>= setEnv
where
- parser = info (helper <*> optionParser) $
- fullDesc <> progDesc "Define environment variables"
+ parser = info (helper <*> versioner <*> optionParser)
+ $ fullDesc
+ <> progDesc "Define environment variables"
+ versioner = infoOption (showVersion Meta.version)
+ $ long "version"
+ <> help "Show version"
+ <> hidden
setEnv :: Options -> IO ()
setEnv options = runExceptT doSetEnv >>= either ioError return
diff --git a/app/UnsetEnv.hs b/app/UnsetEnv.hs
index 5ab28d5..c1e904d 100644
--- a/app/UnsetEnv.hs
+++ b/app/UnsetEnv.hs
@@ -10,10 +10,12 @@ module Main (main) where
import Control.Monad (void)
import Control.Monad.Trans.Except (runExceptT)
import Data.Monoid ((<>))
+import Data.Version (showVersion)
import System.IO.Error (ioError)
import Options.Applicative
+import qualified Paths_windows_env as Meta
import qualified WindowsEnv
import Utils.Prompt
@@ -44,8 +46,13 @@ optionParser = Options
main :: IO ()
main = execParser parser >>= unsetEnv
where
- parser = info (helper <*> optionParser) $
- fullDesc <> progDesc "Delete environment variables"
+ parser = info (helper <*> versioner <*> optionParser)
+ $ fullDesc
+ <> progDesc "Delete environment variables"
+ versioner = infoOption (showVersion Meta.version)
+ $ long "version"
+ <> help "Show version"
+ <> hidden
unsetEnv :: Options -> IO ()
unsetEnv options = runExceptT doUnsetEnv >>= either ioError return