Skip to content

Commit

Permalink
Fix #4983 Add in-app documentation of hidden options
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Mar 29, 2024
1 parent 63b1f30 commit f4a2376
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/Stack/CLI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ commandLineHandler currentDir progName isInterpreter =
"Sets a key in YAML configuration file to value."
(withConfig NoReexec . cfgCmdSet)
configCmdSetParser
addCommand'
addCommandWithLocalInstallRootFooter
ConfigCmd.cfgCmdEnvName
"Print environment variables for use in a shell."
(withConfig YesReexec . withDefaultEnvConfig . cfgCmdEnv)
Expand Down Expand Up @@ -263,7 +263,7 @@ commandLineHandler currentDir progName isInterpreter =
evalCmd
(evalOptsParser "CODE")

exec = addCommand'
exec = addCommandWithLocalInstallRootFooter
"exec"
"Execute a command. If the command is absent, the first of any arguments \
\is taken as the command."
Expand Down Expand Up @@ -407,7 +407,7 @@ commandLineHandler currentDir progName isInterpreter =
newCmd
newOptsParser

path = addCommand'
path = addCommandWithLocalInstallRootFooter
"path"
"Print out handy path information."
Stack.Path.path
Expand Down Expand Up @@ -562,6 +562,22 @@ commandLineHandler currentDir progName isInterpreter =
(\_ gom -> gom)
(globalOpts OtherCmdGlobalOpts)

-- addCommand with custom footer about options affecting the local install
--root and hiding global options
addCommandWithLocalInstallRootFooter ::
String
-> String
-> (a -> RIO Runner ())
-> Parser a
-> AddCommand
addCommandWithLocalInstallRootFooter cmd title constr =
addCommand''
cmd
title
constr
"This command also accepts 'stack build' flags and options that affect \
\the location of the local project installation root directory."

addSubCommands' ::
String
-> String
Expand Down

0 comments on commit f4a2376

Please sign in to comment.