From f4a237656bd37162a636830516199759073b33c6 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Fri, 29 Mar 2024 17:59:56 +0000 Subject: [PATCH] Fix #4983 Add in-app documentation of hidden options --- src/Stack/CLI.hs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Stack/CLI.hs b/src/Stack/CLI.hs index b3eb67abd0..956617dee1 100644 --- a/src/Stack/CLI.hs +++ b/src/Stack/CLI.hs @@ -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) @@ -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." @@ -407,7 +407,7 @@ commandLineHandler currentDir progName isInterpreter = newCmd newOptsParser - path = addCommand' + path = addCommandWithLocalInstallRootFooter "path" "Print out handy path information." Stack.Path.path @@ -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