Add ghcup whereis bindir
and friends, fixes #221
This commit is contained in:
parent
94637dfbab
commit
283f2a6e46
@ -205,6 +205,11 @@ data ChangeLogOptions = ChangeLogOptions
|
|||||||
|
|
||||||
|
|
||||||
data WhereisCommand = WhereisTool Tool (Maybe ToolVersion)
|
data WhereisCommand = WhereisTool Tool (Maybe ToolVersion)
|
||||||
|
| WhereisBaseDir
|
||||||
|
| WhereisBinDir
|
||||||
|
| WhereisCacheDir
|
||||||
|
| WhereisLogsDir
|
||||||
|
| WhereisConfDir
|
||||||
|
|
||||||
data WhereisOptions = WhereisOptions {
|
data WhereisOptions = WhereisOptions {
|
||||||
directory :: Bool
|
directory :: Bool
|
||||||
@ -833,7 +838,8 @@ configP = subparser
|
|||||||
|
|
||||||
whereisP :: Parser WhereisCommand
|
whereisP :: Parser WhereisCommand
|
||||||
whereisP = subparser
|
whereisP = subparser
|
||||||
( command
|
(commandGroup "Tools locations:" <>
|
||||||
|
command
|
||||||
"ghc"
|
"ghc"
|
||||||
(WhereisTool GHC <$> info
|
(WhereisTool GHC <$> info
|
||||||
( optional (toolVersionArgument Nothing (Just GHC)) <**> helper )
|
( optional (toolVersionArgument Nothing (Just GHC)) <**> helper )
|
||||||
@ -868,6 +874,37 @@ whereisP = subparser
|
|||||||
command
|
command
|
||||||
"ghcup"
|
"ghcup"
|
||||||
(WhereisTool GHCup <$> info ( (pure Nothing) <**> helper ) ( progDesc "Get ghcup location" ))
|
(WhereisTool GHCup <$> info ( (pure Nothing) <**> helper ) ( progDesc "Get ghcup location" ))
|
||||||
|
) <|> subparser ( commandGroup "Directory locations:"
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"basedir"
|
||||||
|
(info (pure WhereisBaseDir <**> helper)
|
||||||
|
( progDesc "Get ghcup base directory location" )
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"bindir"
|
||||||
|
(info (pure WhereisBinDir <**> helper)
|
||||||
|
( progDesc "Get ghcup binary directory location" )
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"cachedir"
|
||||||
|
(info (pure WhereisCacheDir <**> helper)
|
||||||
|
( progDesc "Get ghcup cache directory location" )
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"logsdir"
|
||||||
|
(info (pure WhereisLogsDir <**> helper)
|
||||||
|
( progDesc "Get ghcup logs directory location" )
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"confdir"
|
||||||
|
(info (pure WhereisConfDir <**> helper)
|
||||||
|
( progDesc "Get ghcup config directory location" )
|
||||||
|
)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
whereisGHCFooter = [s|Discussion:
|
whereisGHCFooter = [s|Discussion:
|
||||||
@ -2136,6 +2173,26 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ logError $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 30
|
pure $ ExitFailure 30
|
||||||
|
|
||||||
|
Whereis _ WhereisBaseDir -> do
|
||||||
|
putStr baseDir
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
|
Whereis _ WhereisBinDir -> do
|
||||||
|
putStr binDir
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
|
Whereis _ WhereisCacheDir -> do
|
||||||
|
putStr cacheDir
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
|
Whereis _ WhereisLogsDir -> do
|
||||||
|
putStr logsDir
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
|
Whereis _ WhereisConfDir -> do
|
||||||
|
putStr confDir
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
Upgrade uOpts force' -> do
|
Upgrade uOpts force' -> do
|
||||||
target <- case uOpts of
|
target <- case uOpts of
|
||||||
UpgradeInplace -> Just <$> liftIO getExecutablePath
|
UpgradeInplace -> Just <$> liftIO getExecutablePath
|
||||||
|
Loading…
Reference in New Issue
Block a user