From 1ca8429ef47422d83213de568d7683b74e556172 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sat, 1 Aug 2026 21:39:14 -0400 Subject: [PATCH 001/104] Use optparse-applicative for build command --- cabal-install/cabal-install.cabal | 1 + .../src/Distribution/Client/CmdBuild.hs | 136 +++++++++++++++++- cabal-install/src/Distribution/Client/Main.hs | 23 ++- 3 files changed, 158 insertions(+), 2 deletions(-) diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index 83628ab03d1..273b99728f0 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -256,6 +256,7 @@ library , HTTP >= 4000.1.5 && < 4000.6 , mtl >= 2.0 && < 2.4 , network-uri >= 2.6.2.0 && < 2.7 + , optparse-applicative >= 0.18 && < 0.19 , pretty >= 1.1 && < 1.2 , process >= 1.6.29.0 && < 1.7 , random >= 1.2 && < 1.4 diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 7314187b815..b85ab621386 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -1,8 +1,12 @@ +{-# LANGUAGE LambdaCase #-} + -- | cabal-install CLI command: build module Distribution.Client.CmdBuild ( -- * The @build@ CLI and action buildCommand , buildAction + , parseBuildCommand + , isBuildCommandName , BuildFlags (..) , defaultBuildFlags @@ -25,6 +29,7 @@ import Distribution.Client.TargetProblem ) import qualified Data.Map as Map +import Data.Monoid (Endo (..), appEndo) import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -43,7 +48,12 @@ import Distribution.Client.Setup , yesNoOpt ) import Distribution.Simple.Command - ( CommandUI (..) + ( CommandParse (..) + , CommandUI (..) + , OptDescr (..) + , OptionField (..) + , ShowOrParseArgs (ParseArgs) + , commandParseArgs , option , usageAlternatives ) @@ -56,6 +66,10 @@ import Distribution.Verbosity ( normal ) +import Distribution.ReadE (runReadE) + +import qualified Options.Applicative as O + buildCommand :: CommandUI (NixStyleFlags BuildFlags) buildCommand = CommandUI @@ -236,3 +250,123 @@ reportBuildTargetProblems verbosity problems = reportCannotPruneDependencies :: Verbosity -> CannotPruneDependencies -> IO a reportCannotPruneDependencies verbosity = dieWithException verbosity . ReportCannotPruneDependencies . renderCannotPruneDependencies + +buildCommandNames :: [String] +buildCommandNames = ["build", "new-build", commandName buildCommand] + +isBuildCommandName :: String -> Bool +isBuildCommandName name = name `elem` buildCommandNames + +buildListOptions :: [String] +buildListOptions = + case commandParseArgs buildCommand False ["--list-options"] of + CommandList opts -> opts + _ -> [] + +parseBuildCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) +parseBuildCommand invokedName cmdArgs = + case O.execParserPure O.defaultPrefs (buildParserInfo invokedName) cmdArgs of + O.Success parsed -> + if parsedListOptions parsed + then CommandList buildListOptions + else + let flags = appEndo (parsedFlagEdits parsed) (commandDefaultFlags buildCommand) + in CommandReadyToGo (buildAction flags (parsedTargets parsed)) + O.Failure failure -> + let (msg, exitCode) = O.renderFailure failure ("cabal " ++ invokedName) + in if exitCode == ExitSuccess + then CommandHelp (const msg) + else CommandErrors [msg] + O.CompletionInvoked _ -> + CommandErrors ["Shell completion is not supported by this parser path."] + +buildParserInfo :: String -> O.ParserInfo ParsedBuildCommand +buildParserInfo invokedName = + O.info + (parsedBuildCommandParser O.<**> O.helper) + ( O.fullDesc + <> O.progDesc (commandSynopsis buildCommand) + <> O.header ("cabal " ++ invokedName) + ) + +data ParsedBuildCommand = ParsedBuildCommand + { parsedFlagEdits :: Endo (NixStyleFlags BuildFlags) + , parsedTargets :: [String] + , parsedListOptions :: Bool + } + +data BuildItem + = BuildItemFlag (Endo (NixStyleFlags BuildFlags)) + | BuildItemTarget String + | BuildItemListOptions + +parsedBuildCommandParser :: O.Parser ParsedBuildCommand +parsedBuildCommandParser = toParsed <$> O.many buildItemParser + where + toParsed items = + let edits = [e | BuildItemFlag e <- items] + targets = [t | BuildItemTarget t <- items] + listOptionsSeen = any isListOptions items + in ParsedBuildCommand + { parsedFlagEdits = mconcat edits + , parsedTargets = targets + , parsedListOptions = listOptionsSeen + } + + isListOptions BuildItemListOptions = True + isListOptions _ = False + +buildItemParser :: O.Parser BuildItem +buildItemParser = + O.asum + ( buildOptionParsers + ++ [ BuildItemListOptions + <$ O.flag' + () + (O.long "list-options" <> O.help "Print a list of command line flags") + , BuildItemTarget <$> O.strArgument (O.metavar "TARGET") + ] + ) + +buildOptionParsers :: [O.Parser BuildItem] +buildOptionParsers = + concatMap optionFieldParsers (commandOptions buildCommand ParseArgs) + +optionFieldParsers :: OptionField (NixStyleFlags BuildFlags) -> [O.Parser BuildItem] +optionFieldParsers (OptionField _ descrs) = concatMap optDescrParsers descrs + +optDescrParsers :: OptDescr (NixStyleFlags BuildFlags) -> [O.Parser BuildItem] +optDescrParsers = \case + ReqArg desc optFlags placeHolder reader _show -> + [ BuildItemFlag . Endo + <$> O.option + (O.eitherReader (runReadE reader)) + (optionMods optFlags <> O.metavar placeHolder <> O.help desc) + ] + OptArg desc optFlags placeHolder reader (_defaultText, defaultFn) _show -> + [ BuildItemFlag . Endo + <$> ( O.option + (O.eitherReader (runReadE reader)) + (optionMods optFlags <> O.metavar placeHolder <> O.help desc) + <|> O.flag' defaultFn (flagMods optFlags <> O.internal) + ) + ] + ChoiceOpt choices -> + [ BuildItemFlag (Endo setFn) + <$ O.flag' () (flagMods optFlags <> O.help desc) + | (desc, optFlags, setFn, _get) <- choices + ] + BoolOpt desc trueFlags falseFlags setFn _get -> + [ BuildItemFlag (Endo (setFn True)) + <$ O.flag' () (flagMods trueFlags <> O.help desc) + , BuildItemFlag (Endo (setFn False)) + <$ O.flag' () (flagMods falseFlags <> O.help desc) + ] + +optionMods :: (String, [String]) -> O.Mod O.OptionFields a +optionMods (shortFlags, longFlags) = + mconcat (map O.short shortFlags) <> mconcat (map O.long longFlags) + +flagMods :: (String, [String]) -> O.Mod O.FlagFields a +flagMods (shortFlags, longFlags) = + mconcat (map O.short shortFlags) <> mconcat (map O.long longFlags) diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index 2dd8fed4a4a..10b26ff43f5 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -199,6 +199,7 @@ import Distribution.Simple.Command , CommandUI (..) , commandAddAction , commandFromSpec + , commandParseArgs , commandShowOptions , commandsRunWithFallback , defaultCommandFallback @@ -345,7 +346,7 @@ warnIfAssertionsAreEnabled = mainWorker :: [String] -> IO () mainWorker args = do topHandler (isUserException (Proxy @(VerboseException CabalInstallException))) $ do - command <- commandsRunWithFallback (globalCommand commands) commands delegateToExternal args + command <- commandsRunBuildOptparseFirst args case command of CommandHelp help -> printGlobalHelp help CommandList opts -> printOptionsList opts @@ -377,6 +378,24 @@ mainWorker args = do warnIfAssertionsAreEnabled action globalFlags where + commandsRunBuildOptparseFirst :: [String] -> IO (CommandParse (GlobalFlags, CommandParse Action)) + commandsRunBuildOptparseFirst argv = + case parseBuildWithOptparse argv of + Just parsed -> pure parsed + Nothing -> commandsRunWithFallback globalCmd commands delegateToExternal argv + + parseBuildWithOptparse :: [String] -> Maybe (CommandParse (GlobalFlags, CommandParse Action)) + parseBuildWithOptparse argv = + case commandParseArgs globalCmd True argv of + CommandReadyToGo (mkGlobalFlags, cmdArgs0) -> + case cmdArgs0 of + (cmdName : cmdArgs) + | CmdBuild.isBuildCommandName cmdName -> + let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) + in Just $ CommandReadyToGo (globalFlags, CmdBuild.parseBuildCommand cmdName cmdArgs) + _ -> Nothing + _ -> Nothing + delegateToExternal :: [Command Action] -> String @@ -455,6 +474,8 @@ mainWorker args = do | cabalGitInfo == cabalInstallGitInfo = "(in-tree)" | otherwise = cabalGitInfo + globalCmd = globalCommand commands + commands = map commandFromSpec commandSpecs commandSpecs = [ regularCmd listCommand listAction From 4c7810c8d5f4391d829abf0bf68ed0d9884077a4 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sat, 1 Aug 2026 21:56:26 -0400 Subject: [PATCH 002/104] Intro and examples, no flags in usage --- .../src/Distribution/Client/CmdBuild.hs | 55 +++++++++++++++---- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index b85ab621386..5f71558bea4 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -30,6 +30,7 @@ import Distribution.Client.TargetProblem import qualified Data.Map as Map import Data.Monoid (Endo (..), appEndo) +import qualified Data.Text as T import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -90,27 +91,27 @@ buildCommand = ++ "'cabal.project.local' and other files." , commandNotes = Just $ \pname -> "Examples:\n" - ++ " " + ++ " - " ++ pname ++ " v2-build\n" - ++ " Build the package in the current directory " + ++ " Build the package in the current directory " ++ "or all packages in the project\n" - ++ " " + ++ " - " ++ pname ++ " v2-build pkgname\n" - ++ " Build the package named pkgname in the project\n" - ++ " " + ++ " Build the package named pkgname in the project\n" + ++ " - " ++ pname ++ " v2-build ./pkgfoo\n" - ++ " Build the package in the ./pkgfoo directory\n" - ++ " " + ++ " Build the package in the ./pkgfoo directory\n" + ++ " - " ++ pname ++ " v2-build cname\n" - ++ " Build the component named cname in the project\n" - ++ " " + ++ " Build the component named cname in the project\n" + ++ " - " ++ pname ++ " v2-build cname --enable-profiling\n" - ++ " Build the component in profiling mode " + ++ " Build the component in profiling mode " ++ "(including dependencies as needed)\n" , commandDefaultFlags = defaultNixStyleFlags defaultBuildFlags , commandOptions = @@ -263,6 +264,13 @@ buildListOptions = CommandList opts -> opts _ -> [] +buildHelpText :: String -> String -> String +buildHelpText invokedName pname = + case commandParseArgs buildCommand False ["--help"] of + CommandHelp mkHelp -> + T.unpack . T.replace (T.pack "v2-build") (T.pack invokedName) . T.pack $ mkHelp pname + _ -> "Usage: " <> pname <> " " <> invokedName <> " [TARGETS] [FLAGS]\n" + parseBuildCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseBuildCommand invokedName cmdArgs = case O.execParserPure O.defaultPrefs (buildParserInfo invokedName) cmdArgs of @@ -275,7 +283,7 @@ parseBuildCommand invokedName cmdArgs = O.Failure failure -> let (msg, exitCode) = O.renderFailure failure ("cabal " ++ invokedName) in if exitCode == ExitSuccess - then CommandHelp (const msg) + then CommandHelp (buildHelpText invokedName) else CommandErrors [msg] O.CompletionInvoked _ -> CommandErrors ["Shell completion is not supported by this parser path."] @@ -285,10 +293,33 @@ buildParserInfo invokedName = O.info (parsedBuildCommandParser O.<**> O.helper) ( O.fullDesc - <> O.progDesc (commandSynopsis buildCommand) + <> O.progDesc (buildHelpDescription) <> O.header ("cabal " ++ invokedName) + <> O.footer (buildExamplesSection invokedName) ) +buildHelpDescription :: String +buildHelpDescription = + case commandDescription buildCommand of + Nothing -> commandSynopsis buildCommand + Just mkDescription -> mkDescription "cabal" + +buildExamplesSection :: String -> String +buildExamplesSection invokedName = + unlines + [ "Examples:" + , " - " <> invokedName + , " Build the package in the current directory or all packages in the project" + , " - " <> invokedName <> " pkgname" + , " Build the package named pkgname in the project" + , " - " <> invokedName <> " ./pkgfoo" + , " Build the package in the ./pkgfoo directory" + , " - " <> invokedName <> " cname" + , " Build the component named cname in the project" + , " - " <> invokedName <> " cname --enable-profiling" + , " Build the component in profiling mode (including dependencies as needed)" + ] + data ParsedBuildCommand = ParsedBuildCommand { parsedFlagEdits :: Endo (NixStyleFlags BuildFlags) , parsedTargets :: [String] From 8907643fb25f5b77f212c6927eed9a898ce992e3 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sat, 1 Aug 2026 22:24:21 -0400 Subject: [PATCH 003/104] Group options --- .../src/Distribution/Client/CmdBuild.hs | 144 +++++++++++- .../Distribution/Client/NixStyleOptions.hs | 207 ++++++++++++++++++ 2 files changed, 346 insertions(+), 5 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 5f71558bea4..d84cb53ea20 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -31,12 +31,31 @@ import Distribution.Client.TargetProblem import qualified Data.Map as Map import Data.Monoid (Endo (..), appEndo) import qualified Data.Text as T +import qualified System.Console.GetOpt as GetOpt import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions + , removeBenchOptions + , removeCompilerOptions + , removeConfigureOptions + , removeCoverageOptions + , removeExeOptions + , removeHaddockOptions + , removeIncludeOptions + , removeInstallOptions + , removeIrrelevantOptions + , removeLibOptions + , removeLoggingOptions + , removeOutputOptions + , removePhaseOptions + , removeProgOptions + , removeProfilingOptions + , removeSolvingOptions + , removeTestOptions + , removeUnsupportedOptions ) import Distribution.Client.ScriptUtils ( AcceptNoTargets (..) @@ -53,7 +72,7 @@ import Distribution.Simple.Command , CommandUI (..) , OptDescr (..) , OptionField (..) - , ShowOrParseArgs (ParseArgs) + , ShowOrParseArgs (ParseArgs, ShowArgs) , commandParseArgs , option , usageAlternatives @@ -264,12 +283,127 @@ buildListOptions = CommandList opts -> opts _ -> [] +type BuildOptionField = OptionField (NixStyleFlags BuildFlags) + buildHelpText :: String -> String -> String buildHelpText invokedName pname = - case commandParseArgs buildCommand False ["--help"] of - CommandHelp mkHelp -> - T.unpack . T.replace (T.pack "v2-build") (T.pack invokedName) . T.pack $ mkHelp pname - _ -> "Usage: " <> pname <> " " <> invokedName <> " [TARGETS] [FLAGS]\n" + commandSynopsis buildCommand + <> "\n\n" + <> replaceBuildAlias invokedName (commandUsage buildCommand pname) + <> maybe "" (('\n' :) . ($ pname)) (commandDescription buildCommand) + <> "\n" + <> "Flags for build:" + <> GetOpt.usageInfo "" (commonHelpOptions ++ concatMap optionFieldToGetOpt buildUngroupedOptions) + <> concatMap renderGroup buildOptionGroups + <> maybe "" (('\n' :) . replaceBuildAlias invokedName . ($ pname)) (commandNotes buildCommand) + where + commonHelpOptions :: [GetOpt.OptDescr ()] + commonHelpOptions = + [GetOpt.Option ['h'] ["help"] (GetOpt.NoArg ()) "Show this help text"] + + renderGroup :: (String, [BuildOptionField]) -> String + renderGroup (title, options) + | null options = "" + | otherwise = "\n" <> title <> ":" <> GetOpt.usageInfo "" (concatMap optionFieldToGetOpt options) + +buildOptionGroups :: [(String, [BuildOptionField])] +buildOptionGroups = + [ ("Unsupported options", unsupported) + , ("Install layout options", install) + , ("Irrelevant options", irrelevant) + , ("Haddock options", haddock) + , ("Test options", test) + , ("Benchmark options", bench) + , ("Profiling options", profiling) + , ("Dependency solving options", solving) + , ("Executable build options", exe) + , ("Library build options", lib) + , ("Coverage options", coverage) + , ("Output and artifact options", output) + , ("Configure-phase options", configure) + , ("Build phase control options", phase) + , ("Compiler and parallelism options", compiler) + , ("Logging and reporting options", logging) + , ("Include and linker path options", includePaths) + , ("Program override options", prog) + ] + where + opts0 = commandOptions buildCommand ShowArgs + + (unsupported, opts1) = splitBy removeUnsupportedOptions opts0 + (install, opts2) = splitBy removeInstallOptions opts1 + (irrelevant, opts3) = splitBy removeIrrelevantOptions opts2 + (haddock, opts4) = splitBy removeHaddockOptions opts3 + (test, opts5) = splitBy removeTestOptions opts4 + (bench, opts6) = splitBy removeBenchOptions opts5 + (profiling, opts7) = splitBy removeProfilingOptions opts6 + (solving, opts8) = splitBy removeSolvingOptions opts7 + (exe, opts9) = splitBy removeExeOptions opts8 + (lib, opts10) = splitBy removeLibOptions opts9 + (coverage, opts11) = splitBy removeCoverageOptions opts10 + (output, opts12) = splitBy removeOutputOptions opts11 + (configure, opts13) = splitBy removeConfigureOptions opts12 + (phase, opts14) = splitBy removePhaseOptions opts13 + (compiler, opts15) = splitBy removeCompilerOptions opts14 + (logging, opts16) = splitBy removeLoggingOptions opts15 + (includePaths, opts17) = splitBy removeIncludeOptions opts16 + (prog, _opts18) = splitBy removeProgOptions opts17 + +buildUngroupedOptions :: [BuildOptionField] +buildUngroupedOptions = + opts18 + where + opts0 = commandOptions buildCommand ShowArgs + (_, opts1) = splitBy removeUnsupportedOptions opts0 + (_, opts2) = splitBy removeInstallOptions opts1 + (_, opts3) = splitBy removeIrrelevantOptions opts2 + (_, opts4) = splitBy removeHaddockOptions opts3 + (_, opts5) = splitBy removeTestOptions opts4 + (_, opts6) = splitBy removeBenchOptions opts5 + (_, opts7) = splitBy removeProfilingOptions opts6 + (_, opts8) = splitBy removeSolvingOptions opts7 + (_, opts9) = splitBy removeExeOptions opts8 + (_, opts10) = splitBy removeLibOptions opts9 + (_, opts11) = splitBy removeCoverageOptions opts10 + (_, opts12) = splitBy removeOutputOptions opts11 + (_, opts13) = splitBy removeConfigureOptions opts12 + (_, opts14) = splitBy removePhaseOptions opts13 + (_, opts15) = splitBy removeCompilerOptions opts14 + (_, opts16) = splitBy removeLoggingOptions opts15 + (_, opts17) = splitBy removeIncludeOptions opts16 + (_, opts18) = splitBy removeProgOptions opts17 + +splitBy + :: (BuildOptionField -> Bool) + -> [BuildOptionField] + -> ([BuildOptionField], [BuildOptionField]) +splitBy keepPred = partition (not . keepPred) + +optionFieldToGetOpt :: BuildOptionField -> [GetOpt.OptDescr ()] +optionFieldToGetOpt (OptionField _ descrs) = concatMap optDescrToGetOpt descrs + +optDescrToGetOpt :: OptDescr (NixStyleFlags BuildFlags) -> [GetOpt.OptDescr ()] +optDescrToGetOpt = \case + ReqArg desc (shortFlags, longFlags) placeHolder _reader _showFlag -> + [GetOpt.Option shortFlags longFlags (GetOpt.ReqArg (const ()) placeHolder) desc] + OptArg desc (shortFlags, longFlags) placeHolder _reader (_defaultValue, _defaultSetter) _showFlag -> + [GetOpt.Option shortFlags longFlags (GetOpt.OptArg (const ()) placeHolder) desc] + ChoiceOpt choices -> + [ GetOpt.Option shortFlags longFlags (GetOpt.NoArg ()) desc + | (desc, (shortFlags, longFlags), _setFn, _getFn) <- choices + ] + BoolOpt desc (shortTrue, longTrue) (shortFalse, longFalse) _setFn _getFn + | null shortFalse && null longFalse -> + [GetOpt.Option shortTrue longTrue (GetOpt.NoArg ()) desc] + | null shortTrue && null longTrue -> + [GetOpt.Option shortFalse longFalse (GetOpt.NoArg ()) desc] + | otherwise -> + [ GetOpt.Option shortTrue longTrue (GetOpt.NoArg ()) ("Enable " <> desc) + , GetOpt.Option shortFalse longFalse (GetOpt.NoArg ()) ("Disable " <> desc) + ] + +replaceBuildAlias :: String -> String -> String +replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack invokedName) . T.pack parseBuildCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseBuildCommand invokedName cmdArgs = diff --git a/cabal-install/src/Distribution/Client/NixStyleOptions.hs b/cabal-install/src/Distribution/Client/NixStyleOptions.hs index 6201df0d316..dac12b8c71e 100644 --- a/cabal-install/src/Distribution/Client/NixStyleOptions.hs +++ b/cabal-install/src/Distribution/Client/NixStyleOptions.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE ViewPatterns #-} + -- | Command line options for nix-style / v2 commands. -- -- The commands take a lot of the same options, which affect how install plan @@ -8,6 +10,26 @@ module Distribution.Client.NixStyleOptions , defaultNixStyleFlags , updNixStyleCommonSetupFlags , cfgVerbosity + + -- * Option filtering/grouping predicates + , removeUnsupportedOptions + , removeInstallOptions + , removeIrrelevantOptions + , removeHaddockOptions + , removeTestOptions + , removeBenchOptions + , removeProfilingOptions + , removeSolvingOptions + , removeExeOptions + , removeLibOptions + , removeCoverageOptions + , removeOutputOptions + , removeConfigureOptions + , removePhaseOptions + , removeCompilerOptions + , removeLoggingOptions + , removeIncludeOptions + , removeProgOptions ) where import Distribution.Client.Compat.Prelude @@ -40,6 +62,7 @@ import Distribution.Client.Setup , liftOptions , testOptions ) +import Distribution.Simple.Utils (isInfixOf) import Distribution.Verbosity (VerbosityFlags, defaultVerbosityHandles, mkVerbosity) data NixStyleFlags a = NixStyleFlags @@ -162,3 +185,187 @@ cfgVerbosity :: VerbosityFlags -> NixStyleFlags a -> Verbosity cfgVerbosity v flags = mkVerbosity defaultVerbosityHandles $ fromFlagOrDefault v (setupVerbosity . configCommonFlags $ configFlags flags) + +removeUnsupportedOptions :: OptionField a -> Bool +removeUnsupportedOptions = + (\(optionName -> o) -> not ("root-cmd" == o || "allow-boot-library-installs" == o)) + +removeInstallOptions :: OptionField a -> Bool +removeInstallOptions = + ( \(optionName -> o) -> + not + ( "dir" `isSuffixOf` o + || "reinstall" `isInfixOf` o + || "run-tests" == o + || "root-cmd" == o + || "allow-boot-library-installs" == o + || "program-prefix" == o + || "program-suffix" == o + || "ipid" == o + || "cid" == o + || "user" == o + || "global" == o + || "prefix" == o + ) + ) + +removeIrrelevantOptions :: OptionField a -> Bool +removeIrrelevantOptions = (\(optionName -> o) -> not ("per-component" `isSuffixOf` o)) + +removeHaddockOptions :: OptionField a -> Bool +removeHaddockOptions = + ( \(optionName -> o) -> + not + ( "haddock" `isPrefixOf` o + || "documentation" `isSuffixOf` o + || "doc-index-file" == o + ) + ) + +removeTestOptions :: OptionField a -> Bool +removeTestOptions = (\(optionName -> o) -> not ("test" `isPrefixOf` o)) + +removeBenchOptions :: OptionField a -> Bool +removeBenchOptions = (\(optionName -> o) -> not ("bench" `isPrefixOf` o)) + +removeProfilingOptions :: OptionField a -> Bool +removeProfilingOptions = (\(optionName -> o) -> not ("profiling" `isInfixOf` o)) + +removeSolvingOptions :: OptionField a -> Bool +removeSolvingOptions = + ( \(optionName -> o) -> + not + ( "max-backjumps" == o + || "conflicts" `isInfixOf` o + || "goals" `isInfixOf` o + || "index-state" == o + || "upgrade-dependencies" == o + || "reject-unconstrained-dependencies" == o + || "prefer-oldest" == o + || "allow-older" == o + || "allow-newer" == o + || "preference" == o + || "shadow-installed-packages" == o + || "ignore-build-tools" == o + || "solver" == o + || "only-dependencies" == o + || "dependencies-only" == o + || "minimize-conflict-set" == o + || "allow-depending-on-private-libs" == o + ) + ) + +removeExeOptions :: OptionField a -> Bool +removeExeOptions = + ( \(optionName -> o) -> + not + ( "executable" `isInfixOf` o + || "split" `isInfixOf` o + || "stripping" `isInfixOf` o + ) + ) + +removeLibOptions :: OptionField a -> Bool +removeLibOptions = + ( \(optionName -> o) -> + not + ( "vanilla" `isSuffixOf` o + || "shared" `isSuffixOf` o + || "static" `isSuffixOf` o + || "bytecode" `isSuffixOf` o + || "ghci" `isSuffixOf` o + ) + ) + +removeCoverageOptions :: OptionField a -> Bool +removeCoverageOptions = + ( \(optionName -> o) -> + not + ( "coverage" `isSuffixOf` o + || "coverage" `isPrefixOf` o + ) + ) + +removeOutputOptions :: OptionField a -> Bool +removeOutputOptions = + ( \(optionName -> o) -> + not + ( "build-info" `isSuffixOf` o + || "debug-info" `isSuffixOf` o + || "deterministic" `isSuffixOf` o + || "relocatable" `isSuffixOf` o + || "write-ghc-environment-files" == o + ) + ) + +removeConfigureOptions :: OptionField a -> Bool +removeConfigureOptions = + ( \(optionName -> o) -> + not + ( "append" `isSuffixOf` o + || "backup" `isSuffixOf` o + || "configure-option" == o + ) + ) + +removePhaseOptions :: OptionField a -> Bool +removePhaseOptions = + ( \(optionName -> o) -> + not + ( "only-configure" == o + || "only-download" == o + || "dry-run" == o + ) + ) + +removeCompilerOptions :: OptionField a -> Bool +removeCompilerOptions = + ( \(optionName -> o) -> + not + ( "ghc" == o + || "ghcjs" == o + || "uhc" == o + || "with-compiler" == o + || "cabal-lib-version" == o + || "optimization" `isSuffixOf` o + || "semaphore" == o + || "jobs" == o + || "keep-going" == o + || "offline" == o + ) + ) + +removeLoggingOptions :: OptionField a -> Bool +removeLoggingOptions = + ( \(optionName -> o) -> + not + ( "verbose" == o + || "keep-temp-files" == o + || "build-summary" == o + || "build-log" == o + || "build-timings" == o + || "remote-build-reporting" == o + || "report-planning-failure" == o + ) + ) + +removeIncludeOptions :: OptionField a -> Bool +removeIncludeOptions = + ( \(optionName -> o) -> + not + ( "extra-include-dirs" == o + || "extra-lib-dirs" == o + || "extra-framework-dirs" == o + || "extra-prog-path" == o + || "disable-response-files" == o + ) + ) + +removeProgOptions :: OptionField a -> Bool +removeProgOptions = + ( \(optionName -> o) -> + not + ( "with-PROG" == o + || "PROG-option" `isPrefixOf` o + ) + ) From d86fd171187395ec9c4ec0a4a8d1307f186a743e Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 2 Aug 2026 13:52:37 -0400 Subject: [PATCH 004/104] Colorize sections --- cabal-install/src/Distribution/Client/CmdBuild.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index d84cb53ea20..e8c93cf83e9 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -292,7 +292,7 @@ buildHelpText invokedName pname = <> replaceBuildAlias invokedName (commandUsage buildCommand pname) <> maybe "" (('\n' :) . ($ pname)) (commandDescription buildCommand) <> "\n" - <> "Flags for build:" + <> colorizeHeader "Flags for build:" <> GetOpt.usageInfo "" (commonHelpOptions ++ concatMap optionFieldToGetOpt buildUngroupedOptions) <> concatMap renderGroup buildOptionGroups <> maybe "" (('\n' :) . replaceBuildAlias invokedName . ($ pname)) (commandNotes buildCommand) @@ -304,7 +304,7 @@ buildHelpText invokedName pname = renderGroup :: (String, [BuildOptionField]) -> String renderGroup (title, options) | null options = "" - | otherwise = "\n" <> title <> ":" <> GetOpt.usageInfo "" (concatMap optionFieldToGetOpt options) + | otherwise = "\n" <> colorizeHeader (title <> ":") <> GetOpt.usageInfo "" (concatMap optionFieldToGetOpt options) buildOptionGroups :: [(String, [BuildOptionField])] buildOptionGroups = @@ -405,6 +405,9 @@ optDescrToGetOpt = \case replaceBuildAlias :: String -> String -> String replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack invokedName) . T.pack +colorizeHeader :: String -> String +colorizeHeader text = "\ESC[32m" <> text <> "\ESC[0m" + parseBuildCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseBuildCommand invokedName cmdArgs = case O.execParserPure O.defaultPrefs (buildParserInfo invokedName) cmdArgs of From 44dd12ab21f21066385f1a50858b001bcbd1f181 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 2 Aug 2026 13:54:39 -0400 Subject: [PATCH 005/104] Colorize Usage: and Examples: --- cabal-install/src/Distribution/Client/CmdBuild.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index e8c93cf83e9..3aad0825ec7 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -289,13 +289,13 @@ buildHelpText :: String -> String -> String buildHelpText invokedName pname = commandSynopsis buildCommand <> "\n\n" - <> replaceBuildAlias invokedName (commandUsage buildCommand pname) + <> colorizeUsageHeader (replaceBuildAlias invokedName (commandUsage buildCommand pname)) <> maybe "" (('\n' :) . ($ pname)) (commandDescription buildCommand) <> "\n" <> colorizeHeader "Flags for build:" <> GetOpt.usageInfo "" (commonHelpOptions ++ concatMap optionFieldToGetOpt buildUngroupedOptions) <> concatMap renderGroup buildOptionGroups - <> maybe "" (('\n' :) . replaceBuildAlias invokedName . ($ pname)) (commandNotes buildCommand) + <> maybe "" (('\n' :) . colorizeExamplesHeader . replaceBuildAlias invokedName . ($ pname)) (commandNotes buildCommand) where commonHelpOptions :: [GetOpt.OptDescr ()] commonHelpOptions = @@ -408,6 +408,12 @@ replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack colorizeHeader :: String -> String colorizeHeader text = "\ESC[32m" <> text <> "\ESC[0m" +colorizeUsageHeader :: String -> String +colorizeUsageHeader = T.unpack . T.replace (T.pack "Usage:") (T.pack $ colorizeHeader "Usage:") . T.pack + +colorizeExamplesHeader :: String -> String +colorizeExamplesHeader = T.unpack . T.replace (T.pack "Examples:") (T.pack $ colorizeHeader "Examples:") . T.pack + parseBuildCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseBuildCommand invokedName cmdArgs = case O.execParserPure O.defaultPrefs (buildParserInfo invokedName) cmdArgs of From ab2aebe65c55f1f6f6e6ed035b591b999985c660 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 2 Aug 2026 14:06:50 -0400 Subject: [PATCH 006/104] Common starting column for flag help text --- .../src/Distribution/Client/CmdBuild.hs | 59 ++++++++++++++++++- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 3aad0825ec7..833a22bfee4 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -293,7 +293,8 @@ buildHelpText invokedName pname = <> maybe "" (('\n' :) . ($ pname)) (commandDescription buildCommand) <> "\n" <> colorizeHeader "Flags for build:" - <> GetOpt.usageInfo "" (commonHelpOptions ++ concatMap optionFieldToGetOpt buildUngroupedOptions) + <> "\n" + <> renderOptionRows maxFlagColumnWidth descColumn (commonHelpOptions ++ concatMap optionFieldToGetOpt buildUngroupedOptions) <> concatMap renderGroup buildOptionGroups <> maybe "" (('\n' :) . colorizeExamplesHeader . replaceBuildAlias invokedName . ($ pname)) (commandNotes buildCommand) where @@ -301,10 +302,32 @@ buildHelpText invokedName pname = commonHelpOptions = [GetOpt.Option ['h'] ["help"] (GetOpt.NoArg ()) "Show this help text"] + maxFlagColumnWidth :: Int + maxFlagColumnWidth = 56 + + descColumn :: Int + descColumn = + min maxFlagColumnWidth + ( maximum + ( 0 + : map + (length . fst . getOptToColumns) + ( commonHelpOptions + ++ concatMap optionFieldToGetOpt buildUngroupedOptions + ++ concatMap (concatMap optionFieldToGetOpt . snd) buildOptionGroups + ) + ) + ) + + 2 + renderGroup :: (String, [BuildOptionField]) -> String renderGroup (title, options) | null options = "" - | otherwise = "\n" <> colorizeHeader (title <> ":") <> GetOpt.usageInfo "" (concatMap optionFieldToGetOpt options) + | otherwise = + "\n" + <> colorizeHeader (title <> ":") + <> "\n" + <> renderOptionRows maxFlagColumnWidth descColumn (concatMap optionFieldToGetOpt options) buildOptionGroups :: [(String, [BuildOptionField])] buildOptionGroups = @@ -379,6 +402,38 @@ splitBy -> ([BuildOptionField], [BuildOptionField]) splitBy keepPred = partition (not . keepPred) +renderOptionRows :: Int -> Int -> [GetOpt.OptDescr ()] -> String +renderOptionRows maxFlagColumnWidth descColumn = concatMap renderOption + where + renderOption opt = + let (flagColumn, description) = getOptToColumns opt + padding = max 1 (descColumn - length flagColumn) + descriptionIndent = replicate (2 + descColumn) ' ' + in + if length flagColumn <= maxFlagColumnWidth + then " " <> flagColumn <> replicate padding ' ' <> description <> "\n" + else " " <> flagColumn <> "\n" <> descriptionIndent <> description <> "\n" + +getOptToColumns :: GetOpt.OptDescr () -> (String, String) +getOptToColumns (GetOpt.Option shortFlags longFlags argDescr description) = + (intercalate ", " (renderShortFlags ++ renderLongFlags), description) + where + renderShortFlags = map renderShortFlag shortFlags + + renderShortFlag shortFlag = + case argDescr of + GetOpt.NoArg _ -> "-" <> [shortFlag] + GetOpt.ReqArg _ metaVar -> "-" <> [shortFlag] <> " " <> metaVar + GetOpt.OptArg _ metaVar -> "-" <> [shortFlag] <> "[" <> metaVar <> "]" + + renderLongFlags = map renderLongFlag longFlags + + renderLongFlag longFlag = + case argDescr of + GetOpt.NoArg _ -> "--" <> longFlag + GetOpt.ReqArg _ metaVar -> "--" <> longFlag <> "=" <> metaVar + GetOpt.OptArg _ metaVar -> "--" <> longFlag <> "[=" <> metaVar <> "]" + optionFieldToGetOpt :: BuildOptionField -> [GetOpt.OptDescr ()] optionFieldToGetOpt (OptionField _ descrs) = concatMap optDescrToGetOpt descrs From 25fe030419f702197ae742c48e59e409c36cc09b Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 2 Aug 2026 14:09:08 -0400 Subject: [PATCH 007/104] Reduce the maxFlagColumnWidth --- cabal-install/src/Distribution/Client/CmdBuild.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 833a22bfee4..219ba4c7467 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -303,7 +303,7 @@ buildHelpText invokedName pname = [GetOpt.Option ['h'] ["help"] (GetOpt.NoArg ()) "Show this help text"] maxFlagColumnWidth :: Int - maxFlagColumnWidth = 56 + maxFlagColumnWidth = 50 descColumn :: Int descColumn = From 782159d71200a2caf7be175427f338ca529acd19 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 2 Aug 2026 14:13:56 -0400 Subject: [PATCH 008/104] Don't let wrapping help wrap into flag columns --- .../src/Distribution/Client/CmdBuild.hs | 54 ++++++++++++++++--- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 219ba4c7467..3ff853bcd54 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -294,7 +294,7 @@ buildHelpText invokedName pname = <> "\n" <> colorizeHeader "Flags for build:" <> "\n" - <> renderOptionRows maxFlagColumnWidth descColumn (commonHelpOptions ++ concatMap optionFieldToGetOpt buildUngroupedOptions) + <> renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth (commonHelpOptions ++ concatMap optionFieldToGetOpt buildUngroupedOptions) <> concatMap renderGroup buildOptionGroups <> maybe "" (('\n' :) . colorizeExamplesHeader . replaceBuildAlias invokedName . ($ pname)) (commandNotes buildCommand) where @@ -305,6 +305,9 @@ buildHelpText invokedName pname = maxFlagColumnWidth :: Int maxFlagColumnWidth = 50 + helpOutputWidth :: Int + helpOutputWidth = 100 + descColumn :: Int descColumn = min maxFlagColumnWidth @@ -327,7 +330,7 @@ buildHelpText invokedName pname = "\n" <> colorizeHeader (title <> ":") <> "\n" - <> renderOptionRows maxFlagColumnWidth descColumn (concatMap optionFieldToGetOpt options) + <> renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth (concatMap optionFieldToGetOpt options) buildOptionGroups :: [(String, [BuildOptionField])] buildOptionGroups = @@ -402,17 +405,52 @@ splitBy -> ([BuildOptionField], [BuildOptionField]) splitBy keepPred = partition (not . keepPred) -renderOptionRows :: Int -> Int -> [GetOpt.OptDescr ()] -> String -renderOptionRows maxFlagColumnWidth descColumn = concatMap renderOption +renderOptionRows :: Int -> Int -> Int -> [GetOpt.OptDescr ()] -> String +renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth = concatMap renderOption where + descriptionIndent = replicate (2 + descColumn) ' ' + descriptionWidth = max 20 (helpOutputWidth - (2 + descColumn)) + renderOption opt = let (flagColumn, description) = getOptToColumns opt - padding = max 1 (descColumn - length flagColumn) - descriptionIndent = replicate (2 + descColumn) ' ' + wrappedDescription = wrapDescription descriptionWidth description in if length flagColumn <= maxFlagColumnWidth - then " " <> flagColumn <> replicate padding ' ' <> description <> "\n" - else " " <> flagColumn <> "\n" <> descriptionIndent <> description <> "\n" + then renderInline flagColumn wrappedDescription + else renderStacked flagColumn wrappedDescription + + renderInline flagColumn descriptionLines = + let padding = max 1 (descColumn - length flagColumn) + in case descriptionLines of + [] -> " " <> flagColumn <> "\n" + firstLineText : continuation -> + let firstLine = " " <> flagColumn <> replicate padding ' ' <> firstLineText <> "\n" + continuationLines = [descriptionIndent <> line <> "\n" | line <- continuation] + in firstLine <> concat continuationLines + + renderStacked flagColumn descriptionLines = + " " + <> flagColumn + <> "\n" + <> concat [descriptionIndent <> line <> "\n" | line <- descriptionLines] + +wrapDescription :: Int -> String -> [String] +wrapDescription width description = + case concatMap wrapParagraph (lines description) of + [] -> [""] + wrapped -> wrapped + where + wrapParagraph paragraph + | null ws = [""] + | otherwise = reverse (foldl' step [""] ws) + where + ws = words paragraph + + step (current : previous) word + | null current = word : previous + | length current + 1 + length word <= width = (current <> " " <> word) : previous + | otherwise = word : current : previous + step [] _ = [] getOptToColumns :: GetOpt.OptDescr () -> (String, String) getOptToColumns (GetOpt.Option shortFlags longFlags argDescr description) = From 3ead35c73506a056efe5c4022118324df2080650 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 2 Aug 2026 14:15:35 -0400 Subject: [PATCH 009/104] Reduce flag columns to 30 --- cabal-install/src/Distribution/Client/CmdBuild.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 3ff853bcd54..938101bfdc4 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -303,7 +303,7 @@ buildHelpText invokedName pname = [GetOpt.Option ['h'] ["help"] (GetOpt.NoArg ()) "Show this help text"] maxFlagColumnWidth :: Int - maxFlagColumnWidth = 50 + maxFlagColumnWidth = 30 helpOutputWidth :: Int helpOutputWidth = 100 From eccc5caa60da11259aea924d939fa8bc766d6094 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 2 Aug 2026 14:19:19 -0400 Subject: [PATCH 010/104] Add bullet points for help text --- .../src/Distribution/Client/CmdBuild.hs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 938101bfdc4..4b9ae9ed4e3 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -408,8 +408,10 @@ splitBy keepPred = partition (not . keepPred) renderOptionRows :: Int -> Int -> Int -> [GetOpt.OptDescr ()] -> String renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth = concatMap renderOption where + descriptionMarker = "• " + markerPadding = replicate (length descriptionMarker) ' ' descriptionIndent = replicate (2 + descColumn) ' ' - descriptionWidth = max 20 (helpOutputWidth - (2 + descColumn)) + descriptionWidth = max 20 (helpOutputWidth - (2 + descColumn) - length descriptionMarker) renderOption opt = let (flagColumn, description) = getOptToColumns opt @@ -424,15 +426,22 @@ renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth = concatMap rende in case descriptionLines of [] -> " " <> flagColumn <> "\n" firstLineText : continuation -> - let firstLine = " " <> flagColumn <> replicate padding ' ' <> firstLineText <> "\n" - continuationLines = [descriptionIndent <> line <> "\n" | line <- continuation] + let firstLine = " " <> flagColumn <> replicate padding ' ' <> descriptionMarker <> firstLineText <> "\n" + continuationLines = [descriptionIndent <> markerPadding <> line <> "\n" | line <- continuation] in firstLine <> concat continuationLines renderStacked flagColumn descriptionLines = - " " - <> flagColumn - <> "\n" - <> concat [descriptionIndent <> line <> "\n" | line <- descriptionLines] + case descriptionLines of + [] -> " " <> flagColumn <> "\n" + firstLineText : continuation -> + " " + <> flagColumn + <> "\n" + <> descriptionIndent + <> descriptionMarker + <> firstLineText + <> "\n" + <> concat [descriptionIndent <> markerPadding <> line <> "\n" | line <- continuation] wrapDescription :: Int -> String -> [String] wrapDescription width description = From 74a1be28ef1c4d52d5d2c79cbb317d21bf262dc4 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Mon, 3 Aug 2026 15:03:49 -0400 Subject: [PATCH 011/104] Capitalise first char of help, warn if not already --- .../src/Distribution/Client/CmdBuild.hs | 78 +++++++++++++++---- 1 file changed, 62 insertions(+), 16 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 4b9ae9ed4e3..16af9026b3f 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -29,6 +29,7 @@ import Distribution.Client.TargetProblem ) import qualified Data.Map as Map +import Data.Char (isLower) import Data.Monoid (Endo (..), appEndo) import qualified Data.Text as T import qualified System.Console.GetOpt as GetOpt @@ -294,8 +295,9 @@ buildHelpText invokedName pname = <> "\n" <> colorizeHeader "Flags for build:" <> "\n" - <> renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth (commonHelpOptions ++ concatMap optionFieldToGetOpt buildUngroupedOptions) - <> concatMap renderGroup buildOptionGroups + <> ungroupedRows + <> groupedRows + <> warningSection <> maybe "" (('\n' :) . colorizeExamplesHeader . replaceBuildAlias invokedName . ($ pname)) (commandNotes buildCommand) where commonHelpOptions :: [GetOpt.OptDescr ()] @@ -323,14 +325,36 @@ buildHelpText invokedName pname = ) + 2 - renderGroup :: (String, [BuildOptionField]) -> String + (ungroupedRows, ungroupedWarnings) = + renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth (commonHelpOptions ++ concatMap optionFieldToGetOpt buildUngroupedOptions) + + renderedGroups = map renderGroup buildOptionGroups + + groupedRows = concatMap fst renderedGroups + + groupedWarnings = concatMap snd renderedGroups + + warningSection = + case ungroupedWarnings ++ groupedWarnings of + [] -> "" + warnings -> + "\n" + <> "Warnings:\n" + <> concat [" - " <> warning <> "\n" | warning <- warnings] + + renderGroup :: (String, [BuildOptionField]) -> (String, [String]) renderGroup (title, options) - | null options = "" + | null options = ("", []) | otherwise = - "\n" - <> colorizeHeader (title <> ":") - <> "\n" - <> renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth (concatMap optionFieldToGetOpt options) + let (rows, warnings) = + renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth (concatMap optionFieldToGetOpt options) + in + ( "\n" + <> colorizeHeader (title <> ":") + <> "\n" + <> rows + , warnings + ) buildOptionGroups :: [(String, [BuildOptionField])] buildOptionGroups = @@ -405,21 +429,32 @@ splitBy -> ([BuildOptionField], [BuildOptionField]) splitBy keepPred = partition (not . keepPred) -renderOptionRows :: Int -> Int -> Int -> [GetOpt.OptDescr ()] -> String -renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth = concatMap renderOption +renderOptionRows :: Int -> Int -> Int -> [GetOpt.OptDescr ()] -> (String, [String]) +renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth options = + let rendered = [renderOption (index == 0) opt | (index, opt) <- zip [0 :: Int ..] options] + in (concatMap fst rendered, concatMap snd rendered) where descriptionMarker = "• " markerPadding = replicate (length descriptionMarker) ' ' descriptionIndent = replicate (2 + descColumn) ' ' descriptionWidth = max 20 (helpOutputWidth - (2 + descColumn) - length descriptionMarker) - renderOption opt = + renderOption isFirstInGroup opt = let (flagColumn, description) = getOptToColumns opt - wrappedDescription = wrapDescription descriptionWidth description - in - if length flagColumn <= maxFlagColumnWidth - then renderInline flagColumn wrappedDescription - else renderStacked flagColumn wrappedDescription + (capitalizedDescription, wasAutoCapitalized) = capitalizeDescription description + wrappedDescription = wrapDescription descriptionWidth capitalizedDescription + isStacked = length flagColumn > maxFlagColumnWidth + spacer = if isStacked && not isFirstInGroup then "\n" else "" + warning = + if wasAutoCapitalized + then ["Auto-capitalized help text for " <> flagColumn] + else [] + renderedRow = + spacer + <> if isStacked + then renderStacked flagColumn wrappedDescription + else renderInline flagColumn wrappedDescription + in (renderedRow, warning) renderInline flagColumn descriptionLines = let padding = max 1 (descColumn - length flagColumn) @@ -461,6 +496,17 @@ wrapDescription width description = | otherwise = word : current : previous step [] _ = [] +capitalizeDescription :: String -> (String, Bool) +capitalizeDescription = go [] + where + go acc [] = (reverse acc, False) + go acc (ch : rest) + | isAlpha ch = + if isLower ch + then (reverse acc <> (toUpper ch : rest), True) + else (reverse acc <> (ch : rest), False) + | otherwise = go (ch : acc) rest + getOptToColumns :: GetOpt.OptDescr () -> (String, String) getOptToColumns (GetOpt.Option shortFlags longFlags argDescr description) = (intercalate ", " (renderShortFlags ++ renderLongFlags), description) From b72ce7095f5042700bae712ddac4cf5d8ac4defd Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Mon, 3 Aug 2026 15:05:15 -0400 Subject: [PATCH 012/104] Warnings section in red --- cabal-install/src/Distribution/Client/CmdBuild.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 16af9026b3f..d4448974dbe 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -339,7 +339,8 @@ buildHelpText invokedName pname = [] -> "" warnings -> "\n" - <> "Warnings:\n" + <> colorizeWarningHeader "Warnings:" + <> "\n" <> concat [" - " <> warning <> "\n" | warning <- warnings] renderGroup :: (String, [BuildOptionField]) -> (String, [String]) @@ -556,6 +557,9 @@ replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack colorizeHeader :: String -> String colorizeHeader text = "\ESC[32m" <> text <> "\ESC[0m" +colorizeWarningHeader :: String -> String +colorizeWarningHeader text = "\ESC[31m" <> text <> "\ESC[0m" + colorizeUsageHeader :: String -> String colorizeUsageHeader = T.unpack . T.replace (T.pack "Usage:") (T.pack $ colorizeHeader "Usage:") . T.pack From bc32fa633956cd2a3a507d0bd0936e5ad5ce3e8b Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Mon, 3 Aug 2026 15:08:04 -0400 Subject: [PATCH 013/104] Also make red auto-capitalized first char --- .../src/Distribution/Client/CmdBuild.hs | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index d4448974dbe..9492556d7e3 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -444,6 +444,10 @@ renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth options = let (flagColumn, description) = getOptToColumns opt (capitalizedDescription, wasAutoCapitalized) = capitalizeDescription description wrappedDescription = wrapDescription descriptionWidth capitalizedDescription + displayDescription = + if wasAutoCapitalized + then colorizeFirstAlphaRed wrappedDescription + else wrappedDescription isStacked = length flagColumn > maxFlagColumnWidth spacer = if isStacked && not isFirstInGroup then "\n" else "" warning = @@ -453,8 +457,8 @@ renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth options = renderedRow = spacer <> if isStacked - then renderStacked flagColumn wrappedDescription - else renderInline flagColumn wrappedDescription + then renderStacked flagColumn displayDescription + else renderInline flagColumn displayDescription in (renderedRow, warning) renderInline flagColumn descriptionLines = @@ -508,6 +512,23 @@ capitalizeDescription = go [] else (reverse acc <> (ch : rest), False) | otherwise = go (ch : acc) rest +colorizeFirstAlphaRed :: [String] -> [String] +colorizeFirstAlphaRed = go + where + go [] = [] + go (line : rest) = + case colorizeFirstAlphaInLine line of + Nothing -> line : go rest + Just colored -> colored : rest + + colorizeFirstAlphaInLine :: String -> Maybe String + colorizeFirstAlphaInLine = scan [] + where + scan _ [] = Nothing + scan acc (ch : cs) + | isAlpha ch = Just (reverse acc <> colorizeWarningHeader [ch] <> cs) + | otherwise = scan (ch : acc) cs + getOptToColumns :: GetOpt.OptDescr () -> (String, String) getOptToColumns (GetOpt.Option shortFlags longFlags argDescr description) = (intercalate ", " (renderShortFlags ++ renderLongFlags), description) From 267a456b88ea6e6357fba4a0df5d0d7fd227c659 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Mon, 3 Aug 2026 15:44:36 -0400 Subject: [PATCH 014/104] Add module CommandUIOptParse --- cabal-install/cabal-install.cabal | 1 + .../src/Distribution/Client/CmdBuild.hs | 280 +++--------------- .../Distribution/Client/CommandUIOptParse.hs | 225 ++++++++++++++ 3 files changed, 271 insertions(+), 235 deletions(-) create mode 100644 cabal-install/src/Distribution/Client/CommandUIOptParse.hs diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index 273b99728f0..26d6252c932 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -106,6 +106,7 @@ library Distribution.Client.CmdClean Distribution.Client.CmdConfigure Distribution.Client.CmdErrorMessages + Distribution.Client.CommandUIOptParse Distribution.Client.CmdExec Distribution.Client.CmdFreeze Distribution.Client.CmdHaddock diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 9492556d7e3..d05304c3e43 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE LambdaCase #-} - -- | cabal-install CLI command: build module Distribution.Client.CmdBuild ( -- * The @build@ CLI and action @@ -29,10 +27,10 @@ import Distribution.Client.TargetProblem ) import qualified Data.Map as Map -import Data.Char (isLower) import Data.Monoid (Endo (..), appEndo) import qualified Data.Text as T import qualified System.Console.GetOpt as GetOpt +import qualified Distribution.Client.CommandUIOptParse as CommandUIOpt import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -71,8 +69,7 @@ import Distribution.Client.Setup import Distribution.Simple.Command ( CommandParse (..) , CommandUI (..) - , OptDescr (..) - , OptionField (..) + , OptionField , ShowOrParseArgs (ParseArgs, ShowArgs) , commandParseArgs , option @@ -87,8 +84,6 @@ import Distribution.Verbosity ( normal ) -import Distribution.ReadE (runReadE) - import qualified Options.Applicative as O buildCommand :: CommandUI (NixStyleFlags BuildFlags) @@ -316,17 +311,17 @@ buildHelpText invokedName pname = ( maximum ( 0 : map - (length . fst . getOptToColumns) + (length . fst . CommandUIOpt.getOptToColumns) ( commonHelpOptions - ++ concatMap optionFieldToGetOpt buildUngroupedOptions - ++ concatMap (concatMap optionFieldToGetOpt . snd) buildOptionGroups + ++ concatMap CommandUIOpt.optionFieldToGetOpt buildUngroupedOptions + ++ concatMap (concatMap CommandUIOpt.optionFieldToGetOpt . snd) buildOptionGroups ) ) ) + 2 (ungroupedRows, ungroupedWarnings) = - renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth (commonHelpOptions ++ concatMap optionFieldToGetOpt buildUngroupedOptions) + CommandUIOpt.renderOptionRows colorizeWarningHeader maxFlagColumnWidth descColumn helpOutputWidth (commonHelpOptions ++ concatMap CommandUIOpt.optionFieldToGetOpt buildUngroupedOptions) renderedGroups = map renderGroup buildOptionGroups @@ -348,7 +343,7 @@ buildHelpText invokedName pname = | null options = ("", []) | otherwise = let (rows, warnings) = - renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth (concatMap optionFieldToGetOpt options) + CommandUIOpt.renderOptionRows colorizeWarningHeader maxFlagColumnWidth descColumn helpOutputWidth (concatMap CommandUIOpt.optionFieldToGetOpt options) in ( "\n" <> colorizeHeader (title <> ":") @@ -381,196 +376,50 @@ buildOptionGroups = where opts0 = commandOptions buildCommand ShowArgs - (unsupported, opts1) = splitBy removeUnsupportedOptions opts0 - (install, opts2) = splitBy removeInstallOptions opts1 - (irrelevant, opts3) = splitBy removeIrrelevantOptions opts2 - (haddock, opts4) = splitBy removeHaddockOptions opts3 - (test, opts5) = splitBy removeTestOptions opts4 - (bench, opts6) = splitBy removeBenchOptions opts5 - (profiling, opts7) = splitBy removeProfilingOptions opts6 - (solving, opts8) = splitBy removeSolvingOptions opts7 - (exe, opts9) = splitBy removeExeOptions opts8 - (lib, opts10) = splitBy removeLibOptions opts9 - (coverage, opts11) = splitBy removeCoverageOptions opts10 - (output, opts12) = splitBy removeOutputOptions opts11 - (configure, opts13) = splitBy removeConfigureOptions opts12 - (phase, opts14) = splitBy removePhaseOptions opts13 - (compiler, opts15) = splitBy removeCompilerOptions opts14 - (logging, opts16) = splitBy removeLoggingOptions opts15 - (includePaths, opts17) = splitBy removeIncludeOptions opts16 - (prog, _opts18) = splitBy removeProgOptions opts17 + (unsupported, opts1) = CommandUIOpt.splitBy removeUnsupportedOptions opts0 + (install, opts2) = CommandUIOpt.splitBy removeInstallOptions opts1 + (irrelevant, opts3) = CommandUIOpt.splitBy removeIrrelevantOptions opts2 + (haddock, opts4) = CommandUIOpt.splitBy removeHaddockOptions opts3 + (test, opts5) = CommandUIOpt.splitBy removeTestOptions opts4 + (bench, opts6) = CommandUIOpt.splitBy removeBenchOptions opts5 + (profiling, opts7) = CommandUIOpt.splitBy removeProfilingOptions opts6 + (solving, opts8) = CommandUIOpt.splitBy removeSolvingOptions opts7 + (exe, opts9) = CommandUIOpt.splitBy removeExeOptions opts8 + (lib, opts10) = CommandUIOpt.splitBy removeLibOptions opts9 + (coverage, opts11) = CommandUIOpt.splitBy removeCoverageOptions opts10 + (output, opts12) = CommandUIOpt.splitBy removeOutputOptions opts11 + (configure, opts13) = CommandUIOpt.splitBy removeConfigureOptions opts12 + (phase, opts14) = CommandUIOpt.splitBy removePhaseOptions opts13 + (compiler, opts15) = CommandUIOpt.splitBy removeCompilerOptions opts14 + (logging, opts16) = CommandUIOpt.splitBy removeLoggingOptions opts15 + (includePaths, opts17) = CommandUIOpt.splitBy removeIncludeOptions opts16 + (prog, _opts18) = CommandUIOpt.splitBy removeProgOptions opts17 buildUngroupedOptions :: [BuildOptionField] buildUngroupedOptions = opts18 where opts0 = commandOptions buildCommand ShowArgs - (_, opts1) = splitBy removeUnsupportedOptions opts0 - (_, opts2) = splitBy removeInstallOptions opts1 - (_, opts3) = splitBy removeIrrelevantOptions opts2 - (_, opts4) = splitBy removeHaddockOptions opts3 - (_, opts5) = splitBy removeTestOptions opts4 - (_, opts6) = splitBy removeBenchOptions opts5 - (_, opts7) = splitBy removeProfilingOptions opts6 - (_, opts8) = splitBy removeSolvingOptions opts7 - (_, opts9) = splitBy removeExeOptions opts8 - (_, opts10) = splitBy removeLibOptions opts9 - (_, opts11) = splitBy removeCoverageOptions opts10 - (_, opts12) = splitBy removeOutputOptions opts11 - (_, opts13) = splitBy removeConfigureOptions opts12 - (_, opts14) = splitBy removePhaseOptions opts13 - (_, opts15) = splitBy removeCompilerOptions opts14 - (_, opts16) = splitBy removeLoggingOptions opts15 - (_, opts17) = splitBy removeIncludeOptions opts16 - (_, opts18) = splitBy removeProgOptions opts17 - -splitBy - :: (BuildOptionField -> Bool) - -> [BuildOptionField] - -> ([BuildOptionField], [BuildOptionField]) -splitBy keepPred = partition (not . keepPred) - -renderOptionRows :: Int -> Int -> Int -> [GetOpt.OptDescr ()] -> (String, [String]) -renderOptionRows maxFlagColumnWidth descColumn helpOutputWidth options = - let rendered = [renderOption (index == 0) opt | (index, opt) <- zip [0 :: Int ..] options] - in (concatMap fst rendered, concatMap snd rendered) - where - descriptionMarker = "• " - markerPadding = replicate (length descriptionMarker) ' ' - descriptionIndent = replicate (2 + descColumn) ' ' - descriptionWidth = max 20 (helpOutputWidth - (2 + descColumn) - length descriptionMarker) - - renderOption isFirstInGroup opt = - let (flagColumn, description) = getOptToColumns opt - (capitalizedDescription, wasAutoCapitalized) = capitalizeDescription description - wrappedDescription = wrapDescription descriptionWidth capitalizedDescription - displayDescription = - if wasAutoCapitalized - then colorizeFirstAlphaRed wrappedDescription - else wrappedDescription - isStacked = length flagColumn > maxFlagColumnWidth - spacer = if isStacked && not isFirstInGroup then "\n" else "" - warning = - if wasAutoCapitalized - then ["Auto-capitalized help text for " <> flagColumn] - else [] - renderedRow = - spacer - <> if isStacked - then renderStacked flagColumn displayDescription - else renderInline flagColumn displayDescription - in (renderedRow, warning) - - renderInline flagColumn descriptionLines = - let padding = max 1 (descColumn - length flagColumn) - in case descriptionLines of - [] -> " " <> flagColumn <> "\n" - firstLineText : continuation -> - let firstLine = " " <> flagColumn <> replicate padding ' ' <> descriptionMarker <> firstLineText <> "\n" - continuationLines = [descriptionIndent <> markerPadding <> line <> "\n" | line <- continuation] - in firstLine <> concat continuationLines - - renderStacked flagColumn descriptionLines = - case descriptionLines of - [] -> " " <> flagColumn <> "\n" - firstLineText : continuation -> - " " - <> flagColumn - <> "\n" - <> descriptionIndent - <> descriptionMarker - <> firstLineText - <> "\n" - <> concat [descriptionIndent <> markerPadding <> line <> "\n" | line <- continuation] + (_, opts1) = CommandUIOpt.splitBy removeUnsupportedOptions opts0 + (_, opts2) = CommandUIOpt.splitBy removeInstallOptions opts1 + (_, opts3) = CommandUIOpt.splitBy removeIrrelevantOptions opts2 + (_, opts4) = CommandUIOpt.splitBy removeHaddockOptions opts3 + (_, opts5) = CommandUIOpt.splitBy removeTestOptions opts4 + (_, opts6) = CommandUIOpt.splitBy removeBenchOptions opts5 + (_, opts7) = CommandUIOpt.splitBy removeProfilingOptions opts6 + (_, opts8) = CommandUIOpt.splitBy removeSolvingOptions opts7 + (_, opts9) = CommandUIOpt.splitBy removeExeOptions opts8 + (_, opts10) = CommandUIOpt.splitBy removeLibOptions opts9 + (_, opts11) = CommandUIOpt.splitBy removeCoverageOptions opts10 + (_, opts12) = CommandUIOpt.splitBy removeOutputOptions opts11 + (_, opts13) = CommandUIOpt.splitBy removeConfigureOptions opts12 + (_, opts14) = CommandUIOpt.splitBy removePhaseOptions opts13 + (_, opts15) = CommandUIOpt.splitBy removeCompilerOptions opts14 + (_, opts16) = CommandUIOpt.splitBy removeLoggingOptions opts15 + (_, opts17) = CommandUIOpt.splitBy removeIncludeOptions opts16 + (_, opts18) = CommandUIOpt.splitBy removeProgOptions opts17 + -wrapDescription :: Int -> String -> [String] -wrapDescription width description = - case concatMap wrapParagraph (lines description) of - [] -> [""] - wrapped -> wrapped - where - wrapParagraph paragraph - | null ws = [""] - | otherwise = reverse (foldl' step [""] ws) - where - ws = words paragraph - - step (current : previous) word - | null current = word : previous - | length current + 1 + length word <= width = (current <> " " <> word) : previous - | otherwise = word : current : previous - step [] _ = [] - -capitalizeDescription :: String -> (String, Bool) -capitalizeDescription = go [] - where - go acc [] = (reverse acc, False) - go acc (ch : rest) - | isAlpha ch = - if isLower ch - then (reverse acc <> (toUpper ch : rest), True) - else (reverse acc <> (ch : rest), False) - | otherwise = go (ch : acc) rest - -colorizeFirstAlphaRed :: [String] -> [String] -colorizeFirstAlphaRed = go - where - go [] = [] - go (line : rest) = - case colorizeFirstAlphaInLine line of - Nothing -> line : go rest - Just colored -> colored : rest - - colorizeFirstAlphaInLine :: String -> Maybe String - colorizeFirstAlphaInLine = scan [] - where - scan _ [] = Nothing - scan acc (ch : cs) - | isAlpha ch = Just (reverse acc <> colorizeWarningHeader [ch] <> cs) - | otherwise = scan (ch : acc) cs - -getOptToColumns :: GetOpt.OptDescr () -> (String, String) -getOptToColumns (GetOpt.Option shortFlags longFlags argDescr description) = - (intercalate ", " (renderShortFlags ++ renderLongFlags), description) - where - renderShortFlags = map renderShortFlag shortFlags - - renderShortFlag shortFlag = - case argDescr of - GetOpt.NoArg _ -> "-" <> [shortFlag] - GetOpt.ReqArg _ metaVar -> "-" <> [shortFlag] <> " " <> metaVar - GetOpt.OptArg _ metaVar -> "-" <> [shortFlag] <> "[" <> metaVar <> "]" - - renderLongFlags = map renderLongFlag longFlags - - renderLongFlag longFlag = - case argDescr of - GetOpt.NoArg _ -> "--" <> longFlag - GetOpt.ReqArg _ metaVar -> "--" <> longFlag <> "=" <> metaVar - GetOpt.OptArg _ metaVar -> "--" <> longFlag <> "[=" <> metaVar <> "]" - -optionFieldToGetOpt :: BuildOptionField -> [GetOpt.OptDescr ()] -optionFieldToGetOpt (OptionField _ descrs) = concatMap optDescrToGetOpt descrs - -optDescrToGetOpt :: OptDescr (NixStyleFlags BuildFlags) -> [GetOpt.OptDescr ()] -optDescrToGetOpt = \case - ReqArg desc (shortFlags, longFlags) placeHolder _reader _showFlag -> - [GetOpt.Option shortFlags longFlags (GetOpt.ReqArg (const ()) placeHolder) desc] - OptArg desc (shortFlags, longFlags) placeHolder _reader (_defaultValue, _defaultSetter) _showFlag -> - [GetOpt.Option shortFlags longFlags (GetOpt.OptArg (const ()) placeHolder) desc] - ChoiceOpt choices -> - [ GetOpt.Option shortFlags longFlags (GetOpt.NoArg ()) desc - | (desc, (shortFlags, longFlags), _setFn, _getFn) <- choices - ] - BoolOpt desc (shortTrue, longTrue) (shortFalse, longFalse) _setFn _getFn - | null shortFalse && null longFalse -> - [GetOpt.Option shortTrue longTrue (GetOpt.NoArg ()) desc] - | null shortTrue && null longTrue -> - [GetOpt.Option shortFalse longFalse (GetOpt.NoArg ()) desc] - | otherwise -> - [ GetOpt.Option shortTrue longTrue (GetOpt.NoArg ()) ("Enable " <> desc) - , GetOpt.Option shortFalse longFalse (GetOpt.NoArg ()) ("Disable " <> desc) - ] replaceBuildAlias :: String -> String -> String replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack invokedName) . T.pack @@ -677,43 +526,4 @@ buildItemParser = buildOptionParsers :: [O.Parser BuildItem] buildOptionParsers = - concatMap optionFieldParsers (commandOptions buildCommand ParseArgs) - -optionFieldParsers :: OptionField (NixStyleFlags BuildFlags) -> [O.Parser BuildItem] -optionFieldParsers (OptionField _ descrs) = concatMap optDescrParsers descrs - -optDescrParsers :: OptDescr (NixStyleFlags BuildFlags) -> [O.Parser BuildItem] -optDescrParsers = \case - ReqArg desc optFlags placeHolder reader _show -> - [ BuildItemFlag . Endo - <$> O.option - (O.eitherReader (runReadE reader)) - (optionMods optFlags <> O.metavar placeHolder <> O.help desc) - ] - OptArg desc optFlags placeHolder reader (_defaultText, defaultFn) _show -> - [ BuildItemFlag . Endo - <$> ( O.option - (O.eitherReader (runReadE reader)) - (optionMods optFlags <> O.metavar placeHolder <> O.help desc) - <|> O.flag' defaultFn (flagMods optFlags <> O.internal) - ) - ] - ChoiceOpt choices -> - [ BuildItemFlag (Endo setFn) - <$ O.flag' () (flagMods optFlags <> O.help desc) - | (desc, optFlags, setFn, _get) <- choices - ] - BoolOpt desc trueFlags falseFlags setFn _get -> - [ BuildItemFlag (Endo (setFn True)) - <$ O.flag' () (flagMods trueFlags <> O.help desc) - , BuildItemFlag (Endo (setFn False)) - <$ O.flag' () (flagMods falseFlags <> O.help desc) - ] - -optionMods :: (String, [String]) -> O.Mod O.OptionFields a -optionMods (shortFlags, longFlags) = - mconcat (map O.short shortFlags) <> mconcat (map O.long longFlags) - -flagMods :: (String, [String]) -> O.Mod O.FlagFields a -flagMods (shortFlags, longFlags) = - mconcat (map O.short shortFlags) <> mconcat (map O.long longFlags) + map (BuildItemFlag <$>) (CommandUIOpt.optionFieldFlagParsers (commandOptions buildCommand ParseArgs)) diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs new file mode 100644 index 00000000000..24f61a02759 --- /dev/null +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -0,0 +1,225 @@ +{-# LANGUAGE LambdaCase #-} + +module Distribution.Client.CommandUIOptParse + ( -- * Converting CommandUI options to optparse-applicative parsers + optionFieldFlagParsers + , optionFieldParser + , optDescrParser + , optionMods + , flagMods + + -- * Converting CommandUI options to GetOpt descriptions + , optionFieldToGetOpt + , optDescrToGetOpt + + -- * Help text layout helpers + , renderOptionRows + , getOptToColumns + , wrapDescription + , capitalizeDescription + + -- * Utility helpers + , splitBy + ) where + +import Distribution.Client.Compat.Prelude +import Prelude () + +import Data.Char (isLower) +import Data.Monoid (Endo (..)) +import qualified System.Console.GetOpt as GetOpt + +import Distribution.ReadE (runReadE) +import Distribution.Simple.Command + ( OptDescr (..) + , OptionField (..) + ) + +import qualified Options.Applicative as O + +optionFieldFlagParsers :: [OptionField flags] -> [O.Parser (Endo flags)] +optionFieldFlagParsers = concatMap optionFieldParser + +optionFieldParser :: OptionField flags -> [O.Parser (Endo flags)] +optionFieldParser (OptionField _ descrs) = concatMap optDescrParser descrs + +optDescrParser :: OptDescr flags -> [O.Parser (Endo flags)] +optDescrParser = \case + ReqArg desc optFlags placeHolder reader _show -> + [ Endo + <$> O.option + (O.eitherReader (runReadE reader)) + (optionMods optFlags <> O.metavar placeHolder <> O.help desc) + ] + OptArg desc optFlags placeHolder reader (_defaultText, defaultFn) _show -> + [ Endo + <$> ( O.option + (O.eitherReader (runReadE reader)) + (optionMods optFlags <> O.metavar placeHolder <> O.help desc) + <|> O.flag' defaultFn (flagMods optFlags <> O.internal) + ) + ] + ChoiceOpt choices -> + [ Endo setFn + <$ O.flag' () (flagMods optFlags <> O.help desc) + | (desc, optFlags, setFn, _get) <- choices + ] + BoolOpt desc trueFlags falseFlags setFn _get -> + [ Endo (setFn True) + <$ O.flag' () (flagMods trueFlags <> O.help desc) + , Endo (setFn False) + <$ O.flag' () (flagMods falseFlags <> O.help desc) + ] + +optionMods :: (String, [String]) -> O.Mod O.OptionFields a +optionMods (shortFlags, longFlags) = + mconcat (map O.short shortFlags) <> mconcat (map O.long longFlags) + +flagMods :: (String, [String]) -> O.Mod O.FlagFields a +flagMods (shortFlags, longFlags) = + mconcat (map O.short shortFlags) <> mconcat (map O.long longFlags) + +optionFieldToGetOpt :: OptionField flags -> [GetOpt.OptDescr ()] +optionFieldToGetOpt (OptionField _ descrs) = concatMap optDescrToGetOpt descrs + +optDescrToGetOpt :: OptDescr flags -> [GetOpt.OptDescr ()] +optDescrToGetOpt = \case + ReqArg desc (shortFlags, longFlags) placeHolder _reader _showFlag -> + [GetOpt.Option shortFlags longFlags (GetOpt.ReqArg (const ()) placeHolder) desc] + OptArg desc (shortFlags, longFlags) placeHolder _reader (_defaultValue, _defaultSetter) _showFlag -> + [GetOpt.Option shortFlags longFlags (GetOpt.OptArg (const ()) placeHolder) desc] + ChoiceOpt choices -> + [ GetOpt.Option shortFlags longFlags (GetOpt.NoArg ()) desc + | (desc, (shortFlags, longFlags), _setFn, _getFn) <- choices + ] + BoolOpt desc (shortTrue, longTrue) (shortFalse, longFalse) _setFn _getFn + | null shortFalse && null longFalse -> + [GetOpt.Option shortTrue longTrue (GetOpt.NoArg ()) desc] + | null shortTrue && null longTrue -> + [GetOpt.Option shortFalse longFalse (GetOpt.NoArg ()) desc] + | otherwise -> + [ GetOpt.Option shortTrue longTrue (GetOpt.NoArg ()) ("Enable " <> desc) + , GetOpt.Option shortFalse longFalse (GetOpt.NoArg ()) ("Disable " <> desc) + ] + +renderOptionRows :: (String -> String) -> Int -> Int -> Int -> [GetOpt.OptDescr ()] -> (String, [String]) +renderOptionRows colorizeWarning maxFlagColumnWidth descColumn helpOutputWidth options = + let rendered = [renderOption (index == 0) opt | (index, opt) <- zip [0 :: Int ..] options] + in (concatMap fst rendered, concatMap snd rendered) + where + descriptionMarker = "• " + markerPadding = replicate (length descriptionMarker) ' ' + descriptionIndent = replicate (2 + descColumn) ' ' + descriptionWidth = max 20 (helpOutputWidth - (2 + descColumn) - length descriptionMarker) + + renderOption isFirstInGroup opt = + let (flagColumn, description) = getOptToColumns opt + (capitalizedDescription, wasAutoCapitalized) = capitalizeDescription description + wrappedDescription = wrapDescription descriptionWidth capitalizedDescription + displayDescription = + if wasAutoCapitalized + then colorizeFirstAlpha wrappedDescription + else wrappedDescription + isStacked = length flagColumn > maxFlagColumnWidth + spacer = if isStacked && not isFirstInGroup then "\n" else "" + warning = + if wasAutoCapitalized + then ["Auto-capitalized help text for " <> flagColumn] + else [] + renderedRow = + spacer + <> if isStacked + then renderStacked flagColumn displayDescription + else renderInline flagColumn displayDescription + in (renderedRow, warning) + + colorizeFirstAlpha :: [String] -> [String] + colorizeFirstAlpha = go + where + go [] = [] + go (line : rest) = + case colorizeFirstAlphaInLine line of + Nothing -> line : go rest + Just colored -> colored : rest + + colorizeFirstAlphaInLine :: String -> Maybe String + colorizeFirstAlphaInLine = scan [] + where + scan _ [] = Nothing + scan acc (ch : cs) + | isAlpha ch = Just (reverse acc <> colorizeWarning [ch] <> cs) + | otherwise = scan (ch : acc) cs + + renderInline flagColumn descriptionLines = + let padding = max 1 (descColumn - length flagColumn) + in case descriptionLines of + [] -> " " <> flagColumn <> "\n" + firstLineText : continuation -> + let firstLine = " " <> flagColumn <> replicate padding ' ' <> descriptionMarker <> firstLineText <> "\n" + continuationLines = [descriptionIndent <> markerPadding <> line <> "\n" | line <- continuation] + in firstLine <> concat continuationLines + + renderStacked flagColumn descriptionLines = + case descriptionLines of + [] -> " " <> flagColumn <> "\n" + firstLineText : continuation -> + " " + <> flagColumn + <> "\n" + <> descriptionIndent + <> descriptionMarker + <> firstLineText + <> "\n" + <> concat [descriptionIndent <> markerPadding <> line <> "\n" | line <- continuation] + +wrapDescription :: Int -> String -> [String] +wrapDescription width description = + case concatMap wrapParagraph (lines description) of + [] -> [""] + wrapped -> wrapped + where + wrapParagraph paragraph + | null ws = [""] + | otherwise = reverse (foldl' step [""] ws) + where + ws = words paragraph + + step (current : previous) word + | null current = word : previous + | length current + 1 + length word <= width = (current <> " " <> word) : previous + | otherwise = word : current : previous + step [] _ = [] + +capitalizeDescription :: String -> (String, Bool) +capitalizeDescription = go [] + where + go acc [] = (reverse acc, False) + go acc (ch : rest) + | isAlpha ch = + if isLower ch + then (reverse acc <> (toUpper ch : rest), True) + else (reverse acc <> (ch : rest), False) + | otherwise = go (ch : acc) rest + +getOptToColumns :: GetOpt.OptDescr () -> (String, String) +getOptToColumns (GetOpt.Option shortFlags longFlags argDescr description) = + (intercalate ", " (renderShortFlags ++ renderLongFlags), description) + where + renderShortFlags = map renderShortFlag shortFlags + + renderShortFlag shortFlag = + case argDescr of + GetOpt.NoArg _ -> "-" <> [shortFlag] + GetOpt.ReqArg _ metaVar -> "-" <> [shortFlag] <> " " <> metaVar + GetOpt.OptArg _ metaVar -> "-" <> [shortFlag] <> "[" <> metaVar <> "]" + + renderLongFlags = map renderLongFlag longFlags + + renderLongFlag longFlag = + case argDescr of + GetOpt.NoArg _ -> "--" <> longFlag + GetOpt.ReqArg _ metaVar -> "--" <> longFlag <> "=" <> metaVar + GetOpt.OptArg _ metaVar -> "--" <> longFlag <> "[=" <> metaVar <> "]" + +splitBy :: (a -> Bool) -> [a] -> ([a], [a]) +splitBy keepPred = partition (not . keepPred) From a3f0bec987f61672a8ce60391e2c04cf61bd2c8e Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 08:37:31 -0400 Subject: [PATCH 015/104] Add doctest for buildCommandNames --- cabal-install/src/Distribution/Client/CmdBuild.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index d05304c3e43..682b0937ef3 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -267,6 +267,10 @@ reportCannotPruneDependencies :: Verbosity -> CannotPruneDependencies -> IO a reportCannotPruneDependencies verbosity = dieWithException verbosity . ReportCannotPruneDependencies . renderCannotPruneDependencies +-- | The command name and aliases for the @build@ command. +-- +-- >>> buildCommandNames +-- ["build","new-build","v2-build"] buildCommandNames :: [String] buildCommandNames = ["build", "new-build", commandName buildCommand] From 4cd47f8a79c7b3baa182f70954bd1b2af644962c Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 08:47:32 -0400 Subject: [PATCH 016/104] Follow hlint suggestion: redundant bracket --- cabal-install/src/Distribution/Client/CmdBuild.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 682b0937ef3..832e97a1c67 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -462,7 +462,7 @@ buildParserInfo invokedName = O.info (parsedBuildCommandParser O.<**> O.helper) ( O.fullDesc - <> O.progDesc (buildHelpDescription) + <> O.progDesc buildHelpDescription <> O.header ("cabal " ++ invokedName) <> O.footer (buildExamplesSection invokedName) ) From ef75f3e200226d8ac8e6886562565caccce41ed5 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 08:49:37 -0400 Subject: [PATCH 017/104] Follow hlint suggestions --- .../Distribution/Client/NixStyleOptions.hs | 269 ++++++++---------- 1 file changed, 121 insertions(+), 148 deletions(-) diff --git a/cabal-install/src/Distribution/Client/NixStyleOptions.hs b/cabal-install/src/Distribution/Client/NixStyleOptions.hs index dac12b8c71e..73143a4ea8d 100644 --- a/cabal-install/src/Distribution/Client/NixStyleOptions.hs +++ b/cabal-install/src/Distribution/Client/NixStyleOptions.hs @@ -187,185 +187,158 @@ cfgVerbosity v flags = fromFlagOrDefault v (setupVerbosity . configCommonFlags $ configFlags flags) removeUnsupportedOptions :: OptionField a -> Bool -removeUnsupportedOptions = - (\(optionName -> o) -> not ("root-cmd" == o || "allow-boot-library-installs" == o)) +removeUnsupportedOptions (optionName -> o) = not ("root-cmd" == o || "allow-boot-library-installs" == o) removeInstallOptions :: OptionField a -> Bool -removeInstallOptions = - ( \(optionName -> o) -> - not - ( "dir" `isSuffixOf` o - || "reinstall" `isInfixOf` o - || "run-tests" == o - || "root-cmd" == o - || "allow-boot-library-installs" == o - || "program-prefix" == o - || "program-suffix" == o - || "ipid" == o - || "cid" == o - || "user" == o - || "global" == o - || "prefix" == o - ) - ) +removeInstallOptions (optionName -> o) = + not + ( "dir" `isSuffixOf` o + || "reinstall" `isInfixOf` o + || "run-tests" == o + || "root-cmd" == o + || "allow-boot-library-installs" == o + || "program-prefix" == o + || "program-suffix" == o + || "ipid" == o + || "cid" == o + || "user" == o + || "global" == o + || "prefix" == o + ) removeIrrelevantOptions :: OptionField a -> Bool -removeIrrelevantOptions = (\(optionName -> o) -> not ("per-component" `isSuffixOf` o)) +removeIrrelevantOptions (optionName -> o) = not ("per-component" `isSuffixOf` o) removeHaddockOptions :: OptionField a -> Bool -removeHaddockOptions = - ( \(optionName -> o) -> - not - ( "haddock" `isPrefixOf` o - || "documentation" `isSuffixOf` o - || "doc-index-file" == o - ) - ) +removeHaddockOptions (optionName -> o) = + not + ( "haddock" `isPrefixOf` o + || "documentation" `isSuffixOf` o + || "doc-index-file" == o + ) removeTestOptions :: OptionField a -> Bool -removeTestOptions = (\(optionName -> o) -> not ("test" `isPrefixOf` o)) +removeTestOptions (optionName -> o) = not ("test" `isPrefixOf` o) removeBenchOptions :: OptionField a -> Bool -removeBenchOptions = (\(optionName -> o) -> not ("bench" `isPrefixOf` o)) +removeBenchOptions (optionName -> o) = not ("bench" `isPrefixOf` o) removeProfilingOptions :: OptionField a -> Bool -removeProfilingOptions = (\(optionName -> o) -> not ("profiling" `isInfixOf` o)) +removeProfilingOptions (optionName -> o) = not ("profiling" `isInfixOf` o) removeSolvingOptions :: OptionField a -> Bool -removeSolvingOptions = - ( \(optionName -> o) -> - not - ( "max-backjumps" == o - || "conflicts" `isInfixOf` o - || "goals" `isInfixOf` o - || "index-state" == o - || "upgrade-dependencies" == o - || "reject-unconstrained-dependencies" == o - || "prefer-oldest" == o - || "allow-older" == o - || "allow-newer" == o - || "preference" == o - || "shadow-installed-packages" == o - || "ignore-build-tools" == o - || "solver" == o - || "only-dependencies" == o - || "dependencies-only" == o - || "minimize-conflict-set" == o - || "allow-depending-on-private-libs" == o - ) - ) +removeSolvingOptions (optionName -> o) = + not + ( "max-backjumps" == o + || "conflicts" `isInfixOf` o + || "goals" `isInfixOf` o + || "index-state" == o + || "upgrade-dependencies" == o + || "reject-unconstrained-dependencies" == o + || "prefer-oldest" == o + || "allow-older" == o + || "allow-newer" == o + || "preference" == o + || "shadow-installed-packages" == o + || "ignore-build-tools" == o + || "solver" == o + || "only-dependencies" == o + || "dependencies-only" == o + || "minimize-conflict-set" == o + || "allow-depending-on-private-libs" == o + ) removeExeOptions :: OptionField a -> Bool -removeExeOptions = - ( \(optionName -> o) -> - not - ( "executable" `isInfixOf` o - || "split" `isInfixOf` o - || "stripping" `isInfixOf` o - ) - ) +removeExeOptions (optionName -> o) = + not + ( "executable" `isInfixOf` o + || "split" `isInfixOf` o + || "stripping" `isInfixOf` o + ) removeLibOptions :: OptionField a -> Bool -removeLibOptions = - ( \(optionName -> o) -> - not - ( "vanilla" `isSuffixOf` o - || "shared" `isSuffixOf` o - || "static" `isSuffixOf` o - || "bytecode" `isSuffixOf` o - || "ghci" `isSuffixOf` o - ) - ) +removeLibOptions (optionName -> o) = + not + ( "vanilla" `isSuffixOf` o + || "shared" `isSuffixOf` o + || "static" `isSuffixOf` o + || "bytecode" `isSuffixOf` o + || "ghci" `isSuffixOf` o + ) removeCoverageOptions :: OptionField a -> Bool -removeCoverageOptions = - ( \(optionName -> o) -> - not - ( "coverage" `isSuffixOf` o - || "coverage" `isPrefixOf` o - ) - ) +removeCoverageOptions (optionName -> o) = + not + ( "coverage" `isSuffixOf` o + || "coverage" `isPrefixOf` o + ) removeOutputOptions :: OptionField a -> Bool -removeOutputOptions = - ( \(optionName -> o) -> - not - ( "build-info" `isSuffixOf` o - || "debug-info" `isSuffixOf` o - || "deterministic" `isSuffixOf` o - || "relocatable" `isSuffixOf` o - || "write-ghc-environment-files" == o - ) - ) +removeOutputOptions (optionName -> o) = + not + ( "build-info" `isSuffixOf` o + || "debug-info" `isSuffixOf` o + || "deterministic" `isSuffixOf` o + || "relocatable" `isSuffixOf` o + || "write-ghc-environment-files" == o + ) removeConfigureOptions :: OptionField a -> Bool -removeConfigureOptions = - ( \(optionName -> o) -> - not - ( "append" `isSuffixOf` o - || "backup" `isSuffixOf` o - || "configure-option" == o - ) - ) +removeConfigureOptions (optionName -> o) = + not + ( "append" `isSuffixOf` o + || "backup" `isSuffixOf` o + || "configure-option" == o + ) removePhaseOptions :: OptionField a -> Bool -removePhaseOptions = - ( \(optionName -> o) -> - not - ( "only-configure" == o - || "only-download" == o - || "dry-run" == o - ) - ) +removePhaseOptions (optionName -> o) = + not + ( "only-configure" == o + || "only-download" == o + || "dry-run" == o + ) removeCompilerOptions :: OptionField a -> Bool -removeCompilerOptions = - ( \(optionName -> o) -> - not - ( "ghc" == o - || "ghcjs" == o - || "uhc" == o - || "with-compiler" == o - || "cabal-lib-version" == o - || "optimization" `isSuffixOf` o - || "semaphore" == o - || "jobs" == o - || "keep-going" == o - || "offline" == o - ) - ) +removeCompilerOptions (optionName -> o) = + not + ( "ghc" == o + || "ghcjs" == o + || "uhc" == o + || "with-compiler" == o + || "cabal-lib-version" == o + || "optimization" `isSuffixOf` o + || "semaphore" == o + || "jobs" == o + || "keep-going" == o + || "offline" == o + ) removeLoggingOptions :: OptionField a -> Bool -removeLoggingOptions = - ( \(optionName -> o) -> - not - ( "verbose" == o - || "keep-temp-files" == o - || "build-summary" == o - || "build-log" == o - || "build-timings" == o - || "remote-build-reporting" == o - || "report-planning-failure" == o - ) - ) +removeLoggingOptions (optionName -> o) = + not + ( "verbose" == o + || "keep-temp-files" == o + || "build-summary" == o + || "build-log" == o + || "build-timings" == o + || "remote-build-reporting" == o + || "report-planning-failure" == o + ) removeIncludeOptions :: OptionField a -> Bool -removeIncludeOptions = - ( \(optionName -> o) -> - not - ( "extra-include-dirs" == o - || "extra-lib-dirs" == o - || "extra-framework-dirs" == o - || "extra-prog-path" == o - || "disable-response-files" == o - ) - ) +removeIncludeOptions (optionName -> o) = + not + ( "extra-include-dirs" == o + || "extra-lib-dirs" == o + || "extra-framework-dirs" == o + || "extra-prog-path" == o + || "disable-response-files" == o + ) removeProgOptions :: OptionField a -> Bool -removeProgOptions = - ( \(optionName -> o) -> - not - ( "with-PROG" == o - || "PROG-option" `isPrefixOf` o - ) - ) +removeProgOptions (optionName -> o) = + not + ( "with-PROG" == o + || "PROG-option" `isPrefixOf` o + ) From dc8e64ad4a1808983dc746e1db017034b8b14701 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 09:06:25 -0400 Subject: [PATCH 018/104] Rename remove.*Options to keep.*Options --- .../src/Distribution/Client/CmdBuild.hs | 108 +++---- .../Distribution/Client/NixStyleOptions.hs | 288 ++++++++---------- 2 files changed, 185 insertions(+), 211 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 832e97a1c67..6a077bfac20 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -37,24 +37,24 @@ import Distribution.Client.NixStyleOptions , cfgVerbosity , defaultNixStyleFlags , nixStyleOptions - , removeBenchOptions - , removeCompilerOptions - , removeConfigureOptions - , removeCoverageOptions - , removeExeOptions - , removeHaddockOptions - , removeIncludeOptions - , removeInstallOptions - , removeIrrelevantOptions - , removeLibOptions - , removeLoggingOptions - , removeOutputOptions - , removePhaseOptions - , removeProgOptions - , removeProfilingOptions - , removeSolvingOptions - , removeTestOptions - , removeUnsupportedOptions + , keepBenchOptions + , keepCompilerOptions + , keepConfigureOptions + , keepCoverageOptions + , keepExeOptions + , keepHaddockOptions + , keepIncludeOptions + , keepInstallOptions + , keepIrrelevantOptions + , keepLibOptions + , keepLoggingOptions + , keepOutputOptions + , keepPhaseOptions + , keepProgOptions + , keepProfilingOptions + , keepSolvingOptions + , keepTestOptions + , keepUnsupportedOptions ) import Distribution.Client.ScriptUtils ( AcceptNoTargets (..) @@ -380,48 +380,48 @@ buildOptionGroups = where opts0 = commandOptions buildCommand ShowArgs - (unsupported, opts1) = CommandUIOpt.splitBy removeUnsupportedOptions opts0 - (install, opts2) = CommandUIOpt.splitBy removeInstallOptions opts1 - (irrelevant, opts3) = CommandUIOpt.splitBy removeIrrelevantOptions opts2 - (haddock, opts4) = CommandUIOpt.splitBy removeHaddockOptions opts3 - (test, opts5) = CommandUIOpt.splitBy removeTestOptions opts4 - (bench, opts6) = CommandUIOpt.splitBy removeBenchOptions opts5 - (profiling, opts7) = CommandUIOpt.splitBy removeProfilingOptions opts6 - (solving, opts8) = CommandUIOpt.splitBy removeSolvingOptions opts7 - (exe, opts9) = CommandUIOpt.splitBy removeExeOptions opts8 - (lib, opts10) = CommandUIOpt.splitBy removeLibOptions opts9 - (coverage, opts11) = CommandUIOpt.splitBy removeCoverageOptions opts10 - (output, opts12) = CommandUIOpt.splitBy removeOutputOptions opts11 - (configure, opts13) = CommandUIOpt.splitBy removeConfigureOptions opts12 - (phase, opts14) = CommandUIOpt.splitBy removePhaseOptions opts13 - (compiler, opts15) = CommandUIOpt.splitBy removeCompilerOptions opts14 - (logging, opts16) = CommandUIOpt.splitBy removeLoggingOptions opts15 - (includePaths, opts17) = CommandUIOpt.splitBy removeIncludeOptions opts16 - (prog, _opts18) = CommandUIOpt.splitBy removeProgOptions opts17 + (unsupported, opts1) = CommandUIOpt.splitBy (not . keepUnsupportedOptions) opts0 + (install, opts2) = CommandUIOpt.splitBy (not . keepInstallOptions) opts1 + (irrelevant, opts3) = CommandUIOpt.splitBy (not . keepIrrelevantOptions) opts2 + (haddock, opts4) = CommandUIOpt.splitBy (not . keepHaddockOptions) opts3 + (test, opts5) = CommandUIOpt.splitBy (not . keepTestOptions) opts4 + (bench, opts6) = CommandUIOpt.splitBy (not . keepBenchOptions) opts5 + (profiling, opts7) = CommandUIOpt.splitBy (not . keepProfilingOptions) opts6 + (solving, opts8) = CommandUIOpt.splitBy (not . keepSolvingOptions) opts7 + (exe, opts9) = CommandUIOpt.splitBy (not . keepExeOptions) opts8 + (lib, opts10) = CommandUIOpt.splitBy (not . keepLibOptions) opts9 + (coverage, opts11) = CommandUIOpt.splitBy (not . keepCoverageOptions) opts10 + (output, opts12) = CommandUIOpt.splitBy (not . keepOutputOptions) opts11 + (configure, opts13) = CommandUIOpt.splitBy (not . keepConfigureOptions) opts12 + (phase, opts14) = CommandUIOpt.splitBy (not . keepPhaseOptions) opts13 + (compiler, opts15) = CommandUIOpt.splitBy (not . keepCompilerOptions) opts14 + (logging, opts16) = CommandUIOpt.splitBy (not . keepLoggingOptions) opts15 + (includePaths, opts17) = CommandUIOpt.splitBy (not . keepIncludeOptions) opts16 + (prog, _opts18) = CommandUIOpt.splitBy (not . keepProgOptions) opts17 buildUngroupedOptions :: [BuildOptionField] buildUngroupedOptions = opts18 where opts0 = commandOptions buildCommand ShowArgs - (_, opts1) = CommandUIOpt.splitBy removeUnsupportedOptions opts0 - (_, opts2) = CommandUIOpt.splitBy removeInstallOptions opts1 - (_, opts3) = CommandUIOpt.splitBy removeIrrelevantOptions opts2 - (_, opts4) = CommandUIOpt.splitBy removeHaddockOptions opts3 - (_, opts5) = CommandUIOpt.splitBy removeTestOptions opts4 - (_, opts6) = CommandUIOpt.splitBy removeBenchOptions opts5 - (_, opts7) = CommandUIOpt.splitBy removeProfilingOptions opts6 - (_, opts8) = CommandUIOpt.splitBy removeSolvingOptions opts7 - (_, opts9) = CommandUIOpt.splitBy removeExeOptions opts8 - (_, opts10) = CommandUIOpt.splitBy removeLibOptions opts9 - (_, opts11) = CommandUIOpt.splitBy removeCoverageOptions opts10 - (_, opts12) = CommandUIOpt.splitBy removeOutputOptions opts11 - (_, opts13) = CommandUIOpt.splitBy removeConfigureOptions opts12 - (_, opts14) = CommandUIOpt.splitBy removePhaseOptions opts13 - (_, opts15) = CommandUIOpt.splitBy removeCompilerOptions opts14 - (_, opts16) = CommandUIOpt.splitBy removeLoggingOptions opts15 - (_, opts17) = CommandUIOpt.splitBy removeIncludeOptions opts16 - (_, opts18) = CommandUIOpt.splitBy removeProgOptions opts17 + (_, opts1) = CommandUIOpt.splitBy (not . keepUnsupportedOptions) opts0 + (_, opts2) = CommandUIOpt.splitBy (not . keepInstallOptions) opts1 + (_, opts3) = CommandUIOpt.splitBy (not . keepIrrelevantOptions) opts2 + (_, opts4) = CommandUIOpt.splitBy (not . keepHaddockOptions) opts3 + (_, opts5) = CommandUIOpt.splitBy (not . keepTestOptions) opts4 + (_, opts6) = CommandUIOpt.splitBy (not . keepBenchOptions) opts5 + (_, opts7) = CommandUIOpt.splitBy (not . keepProfilingOptions) opts6 + (_, opts8) = CommandUIOpt.splitBy (not . keepSolvingOptions) opts7 + (_, opts9) = CommandUIOpt.splitBy (not . keepExeOptions) opts8 + (_, opts10) = CommandUIOpt.splitBy (not . keepLibOptions) opts9 + (_, opts11) = CommandUIOpt.splitBy (not . keepCoverageOptions) opts10 + (_, opts12) = CommandUIOpt.splitBy (not . keepOutputOptions) opts11 + (_, opts13) = CommandUIOpt.splitBy (not . keepConfigureOptions) opts12 + (_, opts14) = CommandUIOpt.splitBy (not . keepPhaseOptions) opts13 + (_, opts15) = CommandUIOpt.splitBy (not . keepCompilerOptions) opts14 + (_, opts16) = CommandUIOpt.splitBy (not . keepLoggingOptions) opts15 + (_, opts17) = CommandUIOpt.splitBy (not . keepIncludeOptions) opts16 + (_, opts18) = CommandUIOpt.splitBy (not . keepProgOptions) opts17 diff --git a/cabal-install/src/Distribution/Client/NixStyleOptions.hs b/cabal-install/src/Distribution/Client/NixStyleOptions.hs index 73143a4ea8d..63ea3d6ded0 100644 --- a/cabal-install/src/Distribution/Client/NixStyleOptions.hs +++ b/cabal-install/src/Distribution/Client/NixStyleOptions.hs @@ -12,24 +12,24 @@ module Distribution.Client.NixStyleOptions , cfgVerbosity -- * Option filtering/grouping predicates - , removeUnsupportedOptions - , removeInstallOptions - , removeIrrelevantOptions - , removeHaddockOptions - , removeTestOptions - , removeBenchOptions - , removeProfilingOptions - , removeSolvingOptions - , removeExeOptions - , removeLibOptions - , removeCoverageOptions - , removeOutputOptions - , removeConfigureOptions - , removePhaseOptions - , removeCompilerOptions - , removeLoggingOptions - , removeIncludeOptions - , removeProgOptions + , keepUnsupportedOptions + , keepInstallOptions + , keepIrrelevantOptions + , keepHaddockOptions + , keepTestOptions + , keepBenchOptions + , keepProfilingOptions + , keepSolvingOptions + , keepExeOptions + , keepLibOptions + , keepCoverageOptions + , keepOutputOptions + , keepConfigureOptions + , keepPhaseOptions + , keepCompilerOptions + , keepLoggingOptions + , keepIncludeOptions + , keepProgOptions ) where import Distribution.Client.Compat.Prelude @@ -186,159 +186,133 @@ cfgVerbosity v flags = mkVerbosity defaultVerbosityHandles $ fromFlagOrDefault v (setupVerbosity . configCommonFlags $ configFlags flags) -removeUnsupportedOptions :: OptionField a -> Bool -removeUnsupportedOptions (optionName -> o) = not ("root-cmd" == o || "allow-boot-library-installs" == o) +keepUnsupportedOptions :: OptionField a -> Bool +keepUnsupportedOptions (optionName -> o) = "root-cmd" == o || "allow-boot-library-installs" == o -removeInstallOptions :: OptionField a -> Bool -removeInstallOptions (optionName -> o) = - not - ( "dir" `isSuffixOf` o - || "reinstall" `isInfixOf` o - || "run-tests" == o - || "root-cmd" == o - || "allow-boot-library-installs" == o - || "program-prefix" == o - || "program-suffix" == o - || "ipid" == o - || "cid" == o - || "user" == o - || "global" == o - || "prefix" == o - ) +keepInstallOptions :: OptionField a -> Bool +keepInstallOptions (optionName -> o) = + "dir" `isSuffixOf` o + || "reinstall" `isInfixOf` o + || "run-tests" == o + || "root-cmd" == o + || "allow-boot-library-installs" == o + || "program-prefix" == o + || "program-suffix" == o + || "ipid" == o + || "cid" == o + || "user" == o + || "global" == o + || "prefix" == o -removeIrrelevantOptions :: OptionField a -> Bool -removeIrrelevantOptions (optionName -> o) = not ("per-component" `isSuffixOf` o) +keepIrrelevantOptions :: OptionField a -> Bool +keepIrrelevantOptions (optionName -> o) = "per-component" `isSuffixOf` o -removeHaddockOptions :: OptionField a -> Bool -removeHaddockOptions (optionName -> o) = - not - ( "haddock" `isPrefixOf` o - || "documentation" `isSuffixOf` o - || "doc-index-file" == o - ) +keepHaddockOptions :: OptionField a -> Bool +keepHaddockOptions (optionName -> o) = + "haddock" `isPrefixOf` o + || "documentation" `isSuffixOf` o + || "doc-index-file" == o -removeTestOptions :: OptionField a -> Bool -removeTestOptions (optionName -> o) = not ("test" `isPrefixOf` o) +keepTestOptions :: OptionField a -> Bool +keepTestOptions (optionName -> o) = "test" `isPrefixOf` o -removeBenchOptions :: OptionField a -> Bool -removeBenchOptions (optionName -> o) = not ("bench" `isPrefixOf` o) +keepBenchOptions :: OptionField a -> Bool +keepBenchOptions (optionName -> o) = "bench" `isPrefixOf` o -removeProfilingOptions :: OptionField a -> Bool -removeProfilingOptions (optionName -> o) = not ("profiling" `isInfixOf` o) +keepProfilingOptions :: OptionField a -> Bool +keepProfilingOptions (optionName -> o) = "profiling" `isInfixOf` o -removeSolvingOptions :: OptionField a -> Bool -removeSolvingOptions (optionName -> o) = - not - ( "max-backjumps" == o - || "conflicts" `isInfixOf` o - || "goals" `isInfixOf` o - || "index-state" == o - || "upgrade-dependencies" == o - || "reject-unconstrained-dependencies" == o - || "prefer-oldest" == o - || "allow-older" == o - || "allow-newer" == o - || "preference" == o - || "shadow-installed-packages" == o - || "ignore-build-tools" == o - || "solver" == o - || "only-dependencies" == o - || "dependencies-only" == o - || "minimize-conflict-set" == o - || "allow-depending-on-private-libs" == o - ) +keepSolvingOptions :: OptionField a -> Bool +keepSolvingOptions (optionName -> o) = + "max-backjumps" == o + || "conflicts" `isInfixOf` o + || "goals" `isInfixOf` o + || "index-state" == o + || "upgrade-dependencies" == o + || "reject-unconstrained-dependencies" == o + || "prefer-oldest" == o + || "allow-older" == o + || "allow-newer" == o + || "preference" == o + || "shadow-installed-packages" == o + || "ignore-build-tools" == o + || "solver" == o + || "only-dependencies" == o + || "dependencies-only" == o + || "minimize-conflict-set" == o + || "allow-depending-on-private-libs" == o -removeExeOptions :: OptionField a -> Bool -removeExeOptions (optionName -> o) = - not - ( "executable" `isInfixOf` o - || "split" `isInfixOf` o - || "stripping" `isInfixOf` o - ) +keepExeOptions :: OptionField a -> Bool +keepExeOptions (optionName -> o) = + "executable" `isInfixOf` o + || "split" `isInfixOf` o + || "stripping" `isInfixOf` o -removeLibOptions :: OptionField a -> Bool -removeLibOptions (optionName -> o) = - not - ( "vanilla" `isSuffixOf` o - || "shared" `isSuffixOf` o - || "static" `isSuffixOf` o - || "bytecode" `isSuffixOf` o - || "ghci" `isSuffixOf` o - ) +keepLibOptions :: OptionField a -> Bool +keepLibOptions (optionName -> o) = + "vanilla" `isSuffixOf` o + || "shared" `isSuffixOf` o + || "static" `isSuffixOf` o + || "bytecode" `isSuffixOf` o + || "ghci" `isSuffixOf` o -removeCoverageOptions :: OptionField a -> Bool -removeCoverageOptions (optionName -> o) = - not - ( "coverage" `isSuffixOf` o - || "coverage" `isPrefixOf` o - ) +keepCoverageOptions :: OptionField a -> Bool +keepCoverageOptions (optionName -> o) = + "coverage" `isSuffixOf` o + || "coverage" `isPrefixOf` o -removeOutputOptions :: OptionField a -> Bool -removeOutputOptions (optionName -> o) = - not - ( "build-info" `isSuffixOf` o - || "debug-info" `isSuffixOf` o - || "deterministic" `isSuffixOf` o - || "relocatable" `isSuffixOf` o - || "write-ghc-environment-files" == o - ) +keepOutputOptions :: OptionField a -> Bool +keepOutputOptions (optionName -> o) = + "build-info" `isSuffixOf` o + || "debug-info" `isSuffixOf` o + || "deterministic" `isSuffixOf` o + || "relocatable" `isSuffixOf` o + || "write-ghc-environment-files" == o -removeConfigureOptions :: OptionField a -> Bool -removeConfigureOptions (optionName -> o) = - not - ( "append" `isSuffixOf` o - || "backup" `isSuffixOf` o - || "configure-option" == o - ) +keepConfigureOptions :: OptionField a -> Bool +keepConfigureOptions (optionName -> o) = + "append" `isSuffixOf` o + || "backup" `isSuffixOf` o + || "configure-option" == o -removePhaseOptions :: OptionField a -> Bool -removePhaseOptions (optionName -> o) = - not - ( "only-configure" == o - || "only-download" == o - || "dry-run" == o - ) +keepPhaseOptions :: OptionField a -> Bool +keepPhaseOptions (optionName -> o) = + "only-configure" == o + || "only-download" == o + || "dry-run" == o -removeCompilerOptions :: OptionField a -> Bool -removeCompilerOptions (optionName -> o) = - not - ( "ghc" == o - || "ghcjs" == o - || "uhc" == o - || "with-compiler" == o - || "cabal-lib-version" == o - || "optimization" `isSuffixOf` o - || "semaphore" == o - || "jobs" == o - || "keep-going" == o - || "offline" == o - ) +keepCompilerOptions :: OptionField a -> Bool +keepCompilerOptions (optionName -> o) = + "ghc" == o + || "ghcjs" == o + || "uhc" == o + || "with-compiler" == o + || "cabal-lib-version" == o + || "optimization" `isSuffixOf` o + || "semaphore" == o + || "jobs" == o + || "keep-going" == o + || "offline" == o -removeLoggingOptions :: OptionField a -> Bool -removeLoggingOptions (optionName -> o) = - not - ( "verbose" == o - || "keep-temp-files" == o - || "build-summary" == o - || "build-log" == o - || "build-timings" == o - || "remote-build-reporting" == o - || "report-planning-failure" == o - ) +keepLoggingOptions :: OptionField a -> Bool +keepLoggingOptions (optionName -> o) = + "verbose" == o + || "keep-temp-files" == o + || "build-summary" == o + || "build-log" == o + || "build-timings" == o + || "remote-build-reporting" == o + || "report-planning-failure" == o -removeIncludeOptions :: OptionField a -> Bool -removeIncludeOptions (optionName -> o) = - not - ( "extra-include-dirs" == o - || "extra-lib-dirs" == o - || "extra-framework-dirs" == o - || "extra-prog-path" == o - || "disable-response-files" == o - ) +keepIncludeOptions :: OptionField a -> Bool +keepIncludeOptions (optionName -> o) = + "extra-include-dirs" == o + || "extra-lib-dirs" == o + || "extra-framework-dirs" == o + || "extra-prog-path" == o + || "disable-response-files" == o -removeProgOptions :: OptionField a -> Bool -removeProgOptions (optionName -> o) = - not - ( "with-PROG" == o - || "PROG-option" `isPrefixOf` o - ) +keepProgOptions :: OptionField a -> Bool +keepProgOptions (optionName -> o) = + "with-PROG" == o + || "PROG-option" `isPrefixOf` o From 722dd17a904577cbb46055b3b7b52c6e5e048715 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 09:23:12 -0400 Subject: [PATCH 019/104] Add -Wno-unused-packages to cabal-testsuite --- cabal.project | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cabal.project b/cabal.project index 76b4dccb6c9..725c5053f9d 100644 --- a/cabal.project +++ b/cabal.project @@ -19,3 +19,6 @@ package semaphore-compat if os(windows) package zlib flags: -pkg-config +bundled-c-zlib + +package cabal-testsuite + ghc-options: -Wno-unused-packages From e9ee1ad7417b37311057cade2bccbd9498f6109e Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 09:23:57 -0400 Subject: [PATCH 020/104] Add splitByKeep --- .../src/Distribution/Client/CmdBuild.hs | 72 +++++++++---------- .../Distribution/Client/CommandUIOptParse.hs | 4 ++ 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 6a077bfac20..5403dcb021e 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -380,48 +380,48 @@ buildOptionGroups = where opts0 = commandOptions buildCommand ShowArgs - (unsupported, opts1) = CommandUIOpt.splitBy (not . keepUnsupportedOptions) opts0 - (install, opts2) = CommandUIOpt.splitBy (not . keepInstallOptions) opts1 - (irrelevant, opts3) = CommandUIOpt.splitBy (not . keepIrrelevantOptions) opts2 - (haddock, opts4) = CommandUIOpt.splitBy (not . keepHaddockOptions) opts3 - (test, opts5) = CommandUIOpt.splitBy (not . keepTestOptions) opts4 - (bench, opts6) = CommandUIOpt.splitBy (not . keepBenchOptions) opts5 - (profiling, opts7) = CommandUIOpt.splitBy (not . keepProfilingOptions) opts6 - (solving, opts8) = CommandUIOpt.splitBy (not . keepSolvingOptions) opts7 - (exe, opts9) = CommandUIOpt.splitBy (not . keepExeOptions) opts8 - (lib, opts10) = CommandUIOpt.splitBy (not . keepLibOptions) opts9 - (coverage, opts11) = CommandUIOpt.splitBy (not . keepCoverageOptions) opts10 - (output, opts12) = CommandUIOpt.splitBy (not . keepOutputOptions) opts11 - (configure, opts13) = CommandUIOpt.splitBy (not . keepConfigureOptions) opts12 - (phase, opts14) = CommandUIOpt.splitBy (not . keepPhaseOptions) opts13 - (compiler, opts15) = CommandUIOpt.splitBy (not . keepCompilerOptions) opts14 - (logging, opts16) = CommandUIOpt.splitBy (not . keepLoggingOptions) opts15 - (includePaths, opts17) = CommandUIOpt.splitBy (not . keepIncludeOptions) opts16 - (prog, _opts18) = CommandUIOpt.splitBy (not . keepProgOptions) opts17 + (unsupported, opts1) = CommandUIOpt.splitByKeep keepUnsupportedOptions opts0 + (install, opts2) = CommandUIOpt.splitByKeep keepInstallOptions opts1 + (irrelevant, opts3) = CommandUIOpt.splitByKeep keepIrrelevantOptions opts2 + (haddock, opts4) = CommandUIOpt.splitByKeep keepHaddockOptions opts3 + (test, opts5) = CommandUIOpt.splitByKeep keepTestOptions opts4 + (bench, opts6) = CommandUIOpt.splitByKeep keepBenchOptions opts5 + (profiling, opts7) = CommandUIOpt.splitByKeep keepProfilingOptions opts6 + (solving, opts8) = CommandUIOpt.splitByKeep keepSolvingOptions opts7 + (exe, opts9) = CommandUIOpt.splitByKeep keepExeOptions opts8 + (lib, opts10) = CommandUIOpt.splitByKeep keepLibOptions opts9 + (coverage, opts11) = CommandUIOpt.splitByKeep keepCoverageOptions opts10 + (output, opts12) = CommandUIOpt.splitByKeep keepOutputOptions opts11 + (configure, opts13) = CommandUIOpt.splitByKeep keepConfigureOptions opts12 + (phase, opts14) = CommandUIOpt.splitByKeep keepPhaseOptions opts13 + (compiler, opts15) = CommandUIOpt.splitByKeep keepCompilerOptions opts14 + (logging, opts16) = CommandUIOpt.splitByKeep keepLoggingOptions opts15 + (includePaths, opts17) = CommandUIOpt.splitByKeep keepIncludeOptions opts16 + (prog, _opts18) = CommandUIOpt.splitByKeep keepProgOptions opts17 buildUngroupedOptions :: [BuildOptionField] buildUngroupedOptions = opts18 where opts0 = commandOptions buildCommand ShowArgs - (_, opts1) = CommandUIOpt.splitBy (not . keepUnsupportedOptions) opts0 - (_, opts2) = CommandUIOpt.splitBy (not . keepInstallOptions) opts1 - (_, opts3) = CommandUIOpt.splitBy (not . keepIrrelevantOptions) opts2 - (_, opts4) = CommandUIOpt.splitBy (not . keepHaddockOptions) opts3 - (_, opts5) = CommandUIOpt.splitBy (not . keepTestOptions) opts4 - (_, opts6) = CommandUIOpt.splitBy (not . keepBenchOptions) opts5 - (_, opts7) = CommandUIOpt.splitBy (not . keepProfilingOptions) opts6 - (_, opts8) = CommandUIOpt.splitBy (not . keepSolvingOptions) opts7 - (_, opts9) = CommandUIOpt.splitBy (not . keepExeOptions) opts8 - (_, opts10) = CommandUIOpt.splitBy (not . keepLibOptions) opts9 - (_, opts11) = CommandUIOpt.splitBy (not . keepCoverageOptions) opts10 - (_, opts12) = CommandUIOpt.splitBy (not . keepOutputOptions) opts11 - (_, opts13) = CommandUIOpt.splitBy (not . keepConfigureOptions) opts12 - (_, opts14) = CommandUIOpt.splitBy (not . keepPhaseOptions) opts13 - (_, opts15) = CommandUIOpt.splitBy (not . keepCompilerOptions) opts14 - (_, opts16) = CommandUIOpt.splitBy (not . keepLoggingOptions) opts15 - (_, opts17) = CommandUIOpt.splitBy (not . keepIncludeOptions) opts16 - (_, opts18) = CommandUIOpt.splitBy (not . keepProgOptions) opts17 + (_, opts1) = CommandUIOpt.splitByKeep keepUnsupportedOptions opts0 + (_, opts2) = CommandUIOpt.splitByKeep keepInstallOptions opts1 + (_, opts3) = CommandUIOpt.splitByKeep keepIrrelevantOptions opts2 + (_, opts4) = CommandUIOpt.splitByKeep keepHaddockOptions opts3 + (_, opts5) = CommandUIOpt.splitByKeep keepTestOptions opts4 + (_, opts6) = CommandUIOpt.splitByKeep keepBenchOptions opts5 + (_, opts7) = CommandUIOpt.splitByKeep keepProfilingOptions opts6 + (_, opts8) = CommandUIOpt.splitByKeep keepSolvingOptions opts7 + (_, opts9) = CommandUIOpt.splitByKeep keepExeOptions opts8 + (_, opts10) = CommandUIOpt.splitByKeep keepLibOptions opts9 + (_, opts11) = CommandUIOpt.splitByKeep keepCoverageOptions opts10 + (_, opts12) = CommandUIOpt.splitByKeep keepOutputOptions opts11 + (_, opts13) = CommandUIOpt.splitByKeep keepConfigureOptions opts12 + (_, opts14) = CommandUIOpt.splitByKeep keepPhaseOptions opts13 + (_, opts15) = CommandUIOpt.splitByKeep keepCompilerOptions opts14 + (_, opts16) = CommandUIOpt.splitByKeep keepLoggingOptions opts15 + (_, opts17) = CommandUIOpt.splitByKeep keepIncludeOptions opts16 + (_, opts18) = CommandUIOpt.splitByKeep keepProgOptions opts17 diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs index 24f61a02759..13b489ec7d3 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -20,6 +20,7 @@ module Distribution.Client.CommandUIOptParse -- * Utility helpers , splitBy + , splitByKeep ) where import Distribution.Client.Compat.Prelude @@ -223,3 +224,6 @@ getOptToColumns (GetOpt.Option shortFlags longFlags argDescr description) = splitBy :: (a -> Bool) -> [a] -> ([a], [a]) splitBy keepPred = partition (not . keepPred) + +splitByKeep :: (a -> Bool) -> [a] -> ([a], [a]) +splitByKeep keepPred = partition keepPred From fcd9d8a24054ad253ee4ed78d88e15c9596070d2 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 09:29:40 -0400 Subject: [PATCH 021/104] Replace splitByKeep with partition, remove splitBy --- .../src/Distribution/Client/CmdBuild.hs | 72 +++++++++---------- .../Distribution/Client/CommandUIOptParse.hs | 7 -- 2 files changed, 36 insertions(+), 43 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 5403dcb021e..b3dcc528f8c 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -380,48 +380,48 @@ buildOptionGroups = where opts0 = commandOptions buildCommand ShowArgs - (unsupported, opts1) = CommandUIOpt.splitByKeep keepUnsupportedOptions opts0 - (install, opts2) = CommandUIOpt.splitByKeep keepInstallOptions opts1 - (irrelevant, opts3) = CommandUIOpt.splitByKeep keepIrrelevantOptions opts2 - (haddock, opts4) = CommandUIOpt.splitByKeep keepHaddockOptions opts3 - (test, opts5) = CommandUIOpt.splitByKeep keepTestOptions opts4 - (bench, opts6) = CommandUIOpt.splitByKeep keepBenchOptions opts5 - (profiling, opts7) = CommandUIOpt.splitByKeep keepProfilingOptions opts6 - (solving, opts8) = CommandUIOpt.splitByKeep keepSolvingOptions opts7 - (exe, opts9) = CommandUIOpt.splitByKeep keepExeOptions opts8 - (lib, opts10) = CommandUIOpt.splitByKeep keepLibOptions opts9 - (coverage, opts11) = CommandUIOpt.splitByKeep keepCoverageOptions opts10 - (output, opts12) = CommandUIOpt.splitByKeep keepOutputOptions opts11 - (configure, opts13) = CommandUIOpt.splitByKeep keepConfigureOptions opts12 - (phase, opts14) = CommandUIOpt.splitByKeep keepPhaseOptions opts13 - (compiler, opts15) = CommandUIOpt.splitByKeep keepCompilerOptions opts14 - (logging, opts16) = CommandUIOpt.splitByKeep keepLoggingOptions opts15 - (includePaths, opts17) = CommandUIOpt.splitByKeep keepIncludeOptions opts16 - (prog, _opts18) = CommandUIOpt.splitByKeep keepProgOptions opts17 + (unsupported, opts1) = partition keepUnsupportedOptions opts0 + (install, opts2) = partition keepInstallOptions opts1 + (irrelevant, opts3) = partition keepIrrelevantOptions opts2 + (haddock, opts4) = partition keepHaddockOptions opts3 + (test, opts5) = partition keepTestOptions opts4 + (bench, opts6) = partition keepBenchOptions opts5 + (profiling, opts7) = partition keepProfilingOptions opts6 + (solving, opts8) = partition keepSolvingOptions opts7 + (exe, opts9) = partition keepExeOptions opts8 + (lib, opts10) = partition keepLibOptions opts9 + (coverage, opts11) = partition keepCoverageOptions opts10 + (output, opts12) = partition keepOutputOptions opts11 + (configure, opts13) = partition keepConfigureOptions opts12 + (phase, opts14) = partition keepPhaseOptions opts13 + (compiler, opts15) = partition keepCompilerOptions opts14 + (logging, opts16) = partition keepLoggingOptions opts15 + (includePaths, opts17) = partition keepIncludeOptions opts16 + (prog, _opts18) = partition keepProgOptions opts17 buildUngroupedOptions :: [BuildOptionField] buildUngroupedOptions = opts18 where opts0 = commandOptions buildCommand ShowArgs - (_, opts1) = CommandUIOpt.splitByKeep keepUnsupportedOptions opts0 - (_, opts2) = CommandUIOpt.splitByKeep keepInstallOptions opts1 - (_, opts3) = CommandUIOpt.splitByKeep keepIrrelevantOptions opts2 - (_, opts4) = CommandUIOpt.splitByKeep keepHaddockOptions opts3 - (_, opts5) = CommandUIOpt.splitByKeep keepTestOptions opts4 - (_, opts6) = CommandUIOpt.splitByKeep keepBenchOptions opts5 - (_, opts7) = CommandUIOpt.splitByKeep keepProfilingOptions opts6 - (_, opts8) = CommandUIOpt.splitByKeep keepSolvingOptions opts7 - (_, opts9) = CommandUIOpt.splitByKeep keepExeOptions opts8 - (_, opts10) = CommandUIOpt.splitByKeep keepLibOptions opts9 - (_, opts11) = CommandUIOpt.splitByKeep keepCoverageOptions opts10 - (_, opts12) = CommandUIOpt.splitByKeep keepOutputOptions opts11 - (_, opts13) = CommandUIOpt.splitByKeep keepConfigureOptions opts12 - (_, opts14) = CommandUIOpt.splitByKeep keepPhaseOptions opts13 - (_, opts15) = CommandUIOpt.splitByKeep keepCompilerOptions opts14 - (_, opts16) = CommandUIOpt.splitByKeep keepLoggingOptions opts15 - (_, opts17) = CommandUIOpt.splitByKeep keepIncludeOptions opts16 - (_, opts18) = CommandUIOpt.splitByKeep keepProgOptions opts17 + (_, opts1) = partition keepUnsupportedOptions opts0 + (_, opts2) = partition keepInstallOptions opts1 + (_, opts3) = partition keepIrrelevantOptions opts2 + (_, opts4) = partition keepHaddockOptions opts3 + (_, opts5) = partition keepTestOptions opts4 + (_, opts6) = partition keepBenchOptions opts5 + (_, opts7) = partition keepProfilingOptions opts6 + (_, opts8) = partition keepSolvingOptions opts7 + (_, opts9) = partition keepExeOptions opts8 + (_, opts10) = partition keepLibOptions opts9 + (_, opts11) = partition keepCoverageOptions opts10 + (_, opts12) = partition keepOutputOptions opts11 + (_, opts13) = partition keepConfigureOptions opts12 + (_, opts14) = partition keepPhaseOptions opts13 + (_, opts15) = partition keepCompilerOptions opts14 + (_, opts16) = partition keepLoggingOptions opts15 + (_, opts17) = partition keepIncludeOptions opts16 + (_, opts18) = partition keepProgOptions opts17 diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs index 13b489ec7d3..d4ebd62ca91 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -18,9 +18,6 @@ module Distribution.Client.CommandUIOptParse , wrapDescription , capitalizeDescription - -- * Utility helpers - , splitBy - , splitByKeep ) where import Distribution.Client.Compat.Prelude @@ -222,8 +219,4 @@ getOptToColumns (GetOpt.Option shortFlags longFlags argDescr description) = GetOpt.ReqArg _ metaVar -> "--" <> longFlag <> "=" <> metaVar GetOpt.OptArg _ metaVar -> "--" <> longFlag <> "[=" <> metaVar <> "]" -splitBy :: (a -> Bool) -> [a] -> ([a], [a]) -splitBy keepPred = partition (not . keepPred) -splitByKeep :: (a -> Bool) -> [a] -> ([a], [a]) -splitByKeep keepPred = partition keepPred From f549759fe6de2a8b00bf646edbcfe05c4318472b Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 09:48:30 -0400 Subject: [PATCH 022/104] Add groupSequentially --- .../src/Distribution/Client/CmdBuild.hs | 115 ++++++------------ .../Distribution/Client/CommandUIOptParse.hs | 13 +- 2 files changed, 49 insertions(+), 79 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index b3dcc528f8c..33ee0bf264c 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -29,14 +29,12 @@ import Distribution.Client.TargetProblem import qualified Data.Map as Map import Data.Monoid (Endo (..), appEndo) import qualified Data.Text as T -import qualified System.Console.GetOpt as GetOpt import qualified Distribution.Client.CommandUIOptParse as CommandUIOpt import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) , cfgVerbosity , defaultNixStyleFlags - , nixStyleOptions , keepBenchOptions , keepCompilerOptions , keepConfigureOptions @@ -50,11 +48,12 @@ import Distribution.Client.NixStyleOptions , keepLoggingOptions , keepOutputOptions , keepPhaseOptions - , keepProgOptions , keepProfilingOptions + , keepProgOptions , keepSolvingOptions , keepTestOptions , keepUnsupportedOptions + , nixStyleOptions ) import Distribution.Client.ScriptUtils ( AcceptNoTargets (..) @@ -83,6 +82,7 @@ import Distribution.Simple.Utils import Distribution.Verbosity ( normal ) +import qualified System.Console.GetOpt as GetOpt import qualified Options.Applicative as O @@ -311,7 +311,8 @@ buildHelpText invokedName pname = descColumn :: Int descColumn = - min maxFlagColumnWidth + min + maxFlagColumnWidth ( maximum ( 0 : map @@ -348,82 +349,42 @@ buildHelpText invokedName pname = | otherwise = let (rows, warnings) = CommandUIOpt.renderOptionRows colorizeWarningHeader maxFlagColumnWidth descColumn helpOutputWidth (concatMap CommandUIOpt.optionFieldToGetOpt options) - in - ( "\n" - <> colorizeHeader (title <> ":") - <> "\n" - <> rows - , warnings - ) + in ( "\n" + <> colorizeHeader (title <> ":") + <> "\n" + <> rows + , warnings + ) + +buildOptionGroupSpecs :: [(String, BuildOptionField -> Bool)] +buildOptionGroupSpecs = + [ ("Unsupported options", keepUnsupportedOptions) + , ("Install layout options", keepInstallOptions) + , ("Irrelevant options", keepIrrelevantOptions) + , ("Haddock options", keepHaddockOptions) + , ("Test options", keepTestOptions) + , ("Benchmark options", keepBenchOptions) + , ("Profiling options", keepProfilingOptions) + , ("Dependency solving options", keepSolvingOptions) + , ("Executable build options", keepExeOptions) + , ("Library build options", keepLibOptions) + , ("Coverage options", keepCoverageOptions) + , ("Output and artifact options", keepOutputOptions) + , ("Configure-phase options", keepConfigureOptions) + , ("Build phase control options", keepPhaseOptions) + , ("Compiler and parallelism options", keepCompilerOptions) + , ("Logging and reporting options", keepLoggingOptions) + , ("Include and linker path options", keepIncludeOptions) + , ("Program override options", keepProgOptions) + ] buildOptionGroups :: [(String, [BuildOptionField])] buildOptionGroups = - [ ("Unsupported options", unsupported) - , ("Install layout options", install) - , ("Irrelevant options", irrelevant) - , ("Haddock options", haddock) - , ("Test options", test) - , ("Benchmark options", bench) - , ("Profiling options", profiling) - , ("Dependency solving options", solving) - , ("Executable build options", exe) - , ("Library build options", lib) - , ("Coverage options", coverage) - , ("Output and artifact options", output) - , ("Configure-phase options", configure) - , ("Build phase control options", phase) - , ("Compiler and parallelism options", compiler) - , ("Logging and reporting options", logging) - , ("Include and linker path options", includePaths) - , ("Program override options", prog) - ] - where - opts0 = commandOptions buildCommand ShowArgs - - (unsupported, opts1) = partition keepUnsupportedOptions opts0 - (install, opts2) = partition keepInstallOptions opts1 - (irrelevant, opts3) = partition keepIrrelevantOptions opts2 - (haddock, opts4) = partition keepHaddockOptions opts3 - (test, opts5) = partition keepTestOptions opts4 - (bench, opts6) = partition keepBenchOptions opts5 - (profiling, opts7) = partition keepProfilingOptions opts6 - (solving, opts8) = partition keepSolvingOptions opts7 - (exe, opts9) = partition keepExeOptions opts8 - (lib, opts10) = partition keepLibOptions opts9 - (coverage, opts11) = partition keepCoverageOptions opts10 - (output, opts12) = partition keepOutputOptions opts11 - (configure, opts13) = partition keepConfigureOptions opts12 - (phase, opts14) = partition keepPhaseOptions opts13 - (compiler, opts15) = partition keepCompilerOptions opts14 - (logging, opts16) = partition keepLoggingOptions opts15 - (includePaths, opts17) = partition keepIncludeOptions opts16 - (prog, _opts18) = partition keepProgOptions opts17 + fst $ CommandUIOpt.groupSequentially (commandOptions buildCommand ShowArgs) buildOptionGroupSpecs buildUngroupedOptions :: [BuildOptionField] buildUngroupedOptions = - opts18 - where - opts0 = commandOptions buildCommand ShowArgs - (_, opts1) = partition keepUnsupportedOptions opts0 - (_, opts2) = partition keepInstallOptions opts1 - (_, opts3) = partition keepIrrelevantOptions opts2 - (_, opts4) = partition keepHaddockOptions opts3 - (_, opts5) = partition keepTestOptions opts4 - (_, opts6) = partition keepBenchOptions opts5 - (_, opts7) = partition keepProfilingOptions opts6 - (_, opts8) = partition keepSolvingOptions opts7 - (_, opts9) = partition keepExeOptions opts8 - (_, opts10) = partition keepLibOptions opts9 - (_, opts11) = partition keepCoverageOptions opts10 - (_, opts12) = partition keepOutputOptions opts11 - (_, opts13) = partition keepConfigureOptions opts12 - (_, opts14) = partition keepPhaseOptions opts13 - (_, opts15) = partition keepCompilerOptions opts14 - (_, opts16) = partition keepLoggingOptions opts15 - (_, opts17) = partition keepIncludeOptions opts16 - (_, opts18) = partition keepProgOptions opts17 - - + snd $ CommandUIOpt.groupSequentially (commandOptions buildCommand ShowArgs) buildOptionGroupSpecs replaceBuildAlias :: String -> String -> String replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack invokedName) . T.pack @@ -521,9 +482,9 @@ buildItemParser = O.asum ( buildOptionParsers ++ [ BuildItemListOptions - <$ O.flag' - () - (O.long "list-options" <> O.help "Print a list of command line flags") + <$ O.flag' + () + (O.long "list-options" <> O.help "Print a list of command line flags") , BuildItemTarget <$> O.strArgument (O.metavar "TARGET") ] ) diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs index d4ebd62ca91..e2804f5d198 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -18,12 +18,15 @@ module Distribution.Client.CommandUIOptParse , wrapDescription , capitalizeDescription + -- * Option grouping helpers + , groupSequentially ) where import Distribution.Client.Compat.Prelude import Prelude () import Data.Char (isLower) +import Data.List (mapAccumL) import Data.Monoid (Endo (..)) import qualified System.Console.GetOpt as GetOpt @@ -59,7 +62,7 @@ optDescrParser = \case ] ChoiceOpt choices -> [ Endo setFn - <$ O.flag' () (flagMods optFlags <> O.help desc) + <$ O.flag' () (flagMods optFlags <> O.help desc) | (desc, optFlags, setFn, _get) <- choices ] BoolOpt desc trueFlags falseFlags setFn _get -> @@ -219,4 +222,10 @@ getOptToColumns (GetOpt.Option shortFlags longFlags argDescr description) = GetOpt.ReqArg _ metaVar -> "--" <> longFlag <> "=" <> metaVar GetOpt.OptArg _ metaVar -> "--" <> longFlag <> "[=" <> metaVar <> "]" - +groupSequentially :: [a] -> [(groupName, a -> Bool)] -> ([(groupName, [a])], [a]) +groupSequentially options groupingSpecs = + let step remaining (groupName, keepPred) = + let (groupMembers, leftovers) = partition keepPred remaining + in (leftovers, (groupName, groupMembers)) + (leftoverOptions, groupedBuckets) = mapAccumL step options groupingSpecs + in (groupedBuckets, leftoverOptions) From 1c2a4e7ee78f2f2ede459d9e88c1ca918899d7f5 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 09:56:10 -0400 Subject: [PATCH 023/104] Add groupPredicates --- .../src/Distribution/Client/CmdBuild.hs | 44 +------------------ .../Distribution/Client/CommandUIOptParse.hs | 43 ++++++++++++++++++ 2 files changed, 45 insertions(+), 42 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 33ee0bf264c..975d5b786bd 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -35,24 +35,6 @@ import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) , cfgVerbosity , defaultNixStyleFlags - , keepBenchOptions - , keepCompilerOptions - , keepConfigureOptions - , keepCoverageOptions - , keepExeOptions - , keepHaddockOptions - , keepIncludeOptions - , keepInstallOptions - , keepIrrelevantOptions - , keepLibOptions - , keepLoggingOptions - , keepOutputOptions - , keepPhaseOptions - , keepProfilingOptions - , keepProgOptions - , keepSolvingOptions - , keepTestOptions - , keepUnsupportedOptions , nixStyleOptions ) import Distribution.Client.ScriptUtils @@ -356,35 +338,13 @@ buildHelpText invokedName pname = , warnings ) -buildOptionGroupSpecs :: [(String, BuildOptionField -> Bool)] -buildOptionGroupSpecs = - [ ("Unsupported options", keepUnsupportedOptions) - , ("Install layout options", keepInstallOptions) - , ("Irrelevant options", keepIrrelevantOptions) - , ("Haddock options", keepHaddockOptions) - , ("Test options", keepTestOptions) - , ("Benchmark options", keepBenchOptions) - , ("Profiling options", keepProfilingOptions) - , ("Dependency solving options", keepSolvingOptions) - , ("Executable build options", keepExeOptions) - , ("Library build options", keepLibOptions) - , ("Coverage options", keepCoverageOptions) - , ("Output and artifact options", keepOutputOptions) - , ("Configure-phase options", keepConfigureOptions) - , ("Build phase control options", keepPhaseOptions) - , ("Compiler and parallelism options", keepCompilerOptions) - , ("Logging and reporting options", keepLoggingOptions) - , ("Include and linker path options", keepIncludeOptions) - , ("Program override options", keepProgOptions) - ] - buildOptionGroups :: [(String, [BuildOptionField])] buildOptionGroups = - fst $ CommandUIOpt.groupSequentially (commandOptions buildCommand ShowArgs) buildOptionGroupSpecs + fst $ CommandUIOpt.groupSequentially (commandOptions buildCommand ShowArgs) CommandUIOpt.groupPredicates buildUngroupedOptions :: [BuildOptionField] buildUngroupedOptions = - snd $ CommandUIOpt.groupSequentially (commandOptions buildCommand ShowArgs) buildOptionGroupSpecs + snd $ CommandUIOpt.groupSequentially (commandOptions buildCommand ShowArgs) CommandUIOpt.groupPredicates replaceBuildAlias :: String -> String -> String replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack invokedName) . T.pack diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs index e2804f5d198..5a879ee6b1a 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -19,6 +19,7 @@ module Distribution.Client.CommandUIOptParse , capitalizeDescription -- * Option grouping helpers + , groupPredicates , groupSequentially ) where @@ -35,6 +36,26 @@ import Distribution.Simple.Command ( OptDescr (..) , OptionField (..) ) +import Distribution.Client.NixStyleOptions + ( keepBenchOptions + , keepCompilerOptions + , keepConfigureOptions + , keepCoverageOptions + , keepExeOptions + , keepHaddockOptions + , keepIncludeOptions + , keepInstallOptions + , keepIrrelevantOptions + , keepLibOptions + , keepLoggingOptions + , keepOutputOptions + , keepPhaseOptions + , keepProfilingOptions + , keepProgOptions + , keepSolvingOptions + , keepTestOptions + , keepUnsupportedOptions + ) import qualified Options.Applicative as O @@ -229,3 +250,25 @@ groupSequentially options groupingSpecs = in (leftovers, (groupName, groupMembers)) (leftoverOptions, groupedBuckets) = mapAccumL step options groupingSpecs in (groupedBuckets, leftoverOptions) + +groupPredicates :: [(String, OptionField a -> Bool)] +groupPredicates = + [ ("Unsupported options", keepUnsupportedOptions) + , ("Install layout options", keepInstallOptions) + , ("Irrelevant options", keepIrrelevantOptions) + , ("Haddock options", keepHaddockOptions) + , ("Test options", keepTestOptions) + , ("Benchmark options", keepBenchOptions) + , ("Profiling options", keepProfilingOptions) + , ("Dependency solving options", keepSolvingOptions) + , ("Executable build options", keepExeOptions) + , ("Library build options", keepLibOptions) + , ("Coverage options", keepCoverageOptions) + , ("Output and artifact options", keepOutputOptions) + , ("Configure-phase options", keepConfigureOptions) + , ("Build phase control options", keepPhaseOptions) + , ("Compiler and parallelism options", keepCompilerOptions) + , ("Logging and reporting options", keepLoggingOptions) + , ("Include and linker path options", keepIncludeOptions) + , ("Program override options", keepProgOptions) + ] From ebce0befbbfb63a50d145ee0ecb0c9be5cb3f70a Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 10:06:31 -0400 Subject: [PATCH 024/104] Calculate (optsGrouped, optsUngrouped) once --- .../src/Distribution/Client/CmdBuild.hs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 975d5b786bd..b4dabed00c1 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -300,17 +300,22 @@ buildHelpText invokedName pname = : map (length . fst . CommandUIOpt.getOptToColumns) ( commonHelpOptions - ++ concatMap CommandUIOpt.optionFieldToGetOpt buildUngroupedOptions - ++ concatMap (concatMap CommandUIOpt.optionFieldToGetOpt . snd) buildOptionGroups + ++ concatMap CommandUIOpt.optionFieldToGetOpt optsUngrouped + ++ concatMap (concatMap CommandUIOpt.optionFieldToGetOpt . snd) optsGrouped ) ) ) + 2 (ungroupedRows, ungroupedWarnings) = - CommandUIOpt.renderOptionRows colorizeWarningHeader maxFlagColumnWidth descColumn helpOutputWidth (commonHelpOptions ++ concatMap CommandUIOpt.optionFieldToGetOpt buildUngroupedOptions) + CommandUIOpt.renderOptionRows + colorizeWarningHeader + maxFlagColumnWidth + descColumn + helpOutputWidth + (commonHelpOptions ++ concatMap CommandUIOpt.optionFieldToGetOpt optsUngrouped) - renderedGroups = map renderGroup buildOptionGroups + renderedGroups = map renderGroup optsGrouped groupedRows = concatMap fst renderedGroups @@ -338,13 +343,8 @@ buildHelpText invokedName pname = , warnings ) -buildOptionGroups :: [(String, [BuildOptionField])] -buildOptionGroups = - fst $ CommandUIOpt.groupSequentially (commandOptions buildCommand ShowArgs) CommandUIOpt.groupPredicates - -buildUngroupedOptions :: [BuildOptionField] -buildUngroupedOptions = - snd $ CommandUIOpt.groupSequentially (commandOptions buildCommand ShowArgs) CommandUIOpt.groupPredicates + (optsGrouped, optsUngrouped) = + CommandUIOpt.groupSequentially (commandOptions buildCommand ShowArgs) CommandUIOpt.groupPredicates replaceBuildAlias :: String -> String -> String replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack invokedName) . T.pack From 5f5ce682b59b3803699cf15dda0a519b4aacc943 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 10:08:47 -0400 Subject: [PATCH 025/104] Add allOptions --- cabal-install/src/Distribution/Client/CmdBuild.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index b4dabed00c1..df8b8340227 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -291,6 +291,12 @@ buildHelpText invokedName pname = helpOutputWidth :: Int helpOutputWidth = 100 + allOptions :: [GetOpt.OptDescr ()] + allOptions = + commonHelpOptions + ++ concatMap CommandUIOpt.optionFieldToGetOpt optsUngrouped + ++ concatMap (concatMap CommandUIOpt.optionFieldToGetOpt . snd) optsGrouped + descColumn :: Int descColumn = min @@ -299,10 +305,7 @@ buildHelpText invokedName pname = ( 0 : map (length . fst . CommandUIOpt.getOptToColumns) - ( commonHelpOptions - ++ concatMap CommandUIOpt.optionFieldToGetOpt optsUngrouped - ++ concatMap (concatMap CommandUIOpt.optionFieldToGetOpt . snd) optsGrouped - ) + allOptions ) ) + 2 From 532e27f4a2964bcb60a73f4663f1d8fddf5f2ea1 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 10:15:18 -0400 Subject: [PATCH 026/104] Styling only --- cabal-install/src/Distribution/Client/CmdBuild.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index df8b8340227..c89cb9b0fa5 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -338,7 +338,12 @@ buildHelpText invokedName pname = | null options = ("", []) | otherwise = let (rows, warnings) = - CommandUIOpt.renderOptionRows colorizeWarningHeader maxFlagColumnWidth descColumn helpOutputWidth (concatMap CommandUIOpt.optionFieldToGetOpt options) + CommandUIOpt.renderOptionRows + colorizeWarningHeader + maxFlagColumnWidth + descColumn + helpOutputWidth + (concatMap CommandUIOpt.optionFieldToGetOpt options) in ( "\n" <> colorizeHeader (title <> ":") <> "\n" From 08dfd573ffa99853c977c2196b78abe01c721747 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 10:31:17 -0400 Subject: [PATCH 027/104] Move helpText to CommandUIOptParse --- .../src/Distribution/Client/CmdBuild.hs | 122 +----------------- .../Distribution/Client/CommandUIOptParse.hs | 106 +++++++++++++++ 2 files changed, 111 insertions(+), 117 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index c89cb9b0fa5..3533968ff80 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -43,29 +43,18 @@ import Distribution.Client.ScriptUtils , updateContextAndWriteProjectFile , withContextAndSelectors ) -import Distribution.Client.Setup - ( GlobalFlags - , yesNoOpt - ) +import Distribution.Client.Setup (GlobalFlags, yesNoOpt) import Distribution.Simple.Command ( CommandParse (..) , CommandUI (..) - , OptionField - , ShowOrParseArgs (ParseArgs, ShowArgs) + , ShowOrParseArgs (ParseArgs) , commandParseArgs , option , usageAlternatives ) import Distribution.Simple.Flag (Flag, fromFlag, toFlag) -import Distribution.Simple.Utils - ( dieWithException - , wrapText - ) -import Distribution.Verbosity - ( normal - ) -import qualified System.Console.GetOpt as GetOpt - +import Distribution.Simple.Utils (dieWithException, wrapText) +import Distribution.Verbosity (normal) import qualified Options.Applicative as O buildCommand :: CommandUI (NixStyleFlags BuildFlags) @@ -265,110 +254,9 @@ buildListOptions = CommandList opts -> opts _ -> [] -type BuildOptionField = OptionField (NixStyleFlags BuildFlags) - -buildHelpText :: String -> String -> String -buildHelpText invokedName pname = - commandSynopsis buildCommand - <> "\n\n" - <> colorizeUsageHeader (replaceBuildAlias invokedName (commandUsage buildCommand pname)) - <> maybe "" (('\n' :) . ($ pname)) (commandDescription buildCommand) - <> "\n" - <> colorizeHeader "Flags for build:" - <> "\n" - <> ungroupedRows - <> groupedRows - <> warningSection - <> maybe "" (('\n' :) . colorizeExamplesHeader . replaceBuildAlias invokedName . ($ pname)) (commandNotes buildCommand) - where - commonHelpOptions :: [GetOpt.OptDescr ()] - commonHelpOptions = - [GetOpt.Option ['h'] ["help"] (GetOpt.NoArg ()) "Show this help text"] - - maxFlagColumnWidth :: Int - maxFlagColumnWidth = 30 - - helpOutputWidth :: Int - helpOutputWidth = 100 - - allOptions :: [GetOpt.OptDescr ()] - allOptions = - commonHelpOptions - ++ concatMap CommandUIOpt.optionFieldToGetOpt optsUngrouped - ++ concatMap (concatMap CommandUIOpt.optionFieldToGetOpt . snd) optsGrouped - - descColumn :: Int - descColumn = - min - maxFlagColumnWidth - ( maximum - ( 0 - : map - (length . fst . CommandUIOpt.getOptToColumns) - allOptions - ) - ) - + 2 - - (ungroupedRows, ungroupedWarnings) = - CommandUIOpt.renderOptionRows - colorizeWarningHeader - maxFlagColumnWidth - descColumn - helpOutputWidth - (commonHelpOptions ++ concatMap CommandUIOpt.optionFieldToGetOpt optsUngrouped) - - renderedGroups = map renderGroup optsGrouped - - groupedRows = concatMap fst renderedGroups - - groupedWarnings = concatMap snd renderedGroups - - warningSection = - case ungroupedWarnings ++ groupedWarnings of - [] -> "" - warnings -> - "\n" - <> colorizeWarningHeader "Warnings:" - <> "\n" - <> concat [" - " <> warning <> "\n" | warning <- warnings] - - renderGroup :: (String, [BuildOptionField]) -> (String, [String]) - renderGroup (title, options) - | null options = ("", []) - | otherwise = - let (rows, warnings) = - CommandUIOpt.renderOptionRows - colorizeWarningHeader - maxFlagColumnWidth - descColumn - helpOutputWidth - (concatMap CommandUIOpt.optionFieldToGetOpt options) - in ( "\n" - <> colorizeHeader (title <> ":") - <> "\n" - <> rows - , warnings - ) - - (optsGrouped, optsUngrouped) = - CommandUIOpt.groupSequentially (commandOptions buildCommand ShowArgs) CommandUIOpt.groupPredicates - replaceBuildAlias :: String -> String -> String replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack invokedName) . T.pack -colorizeHeader :: String -> String -colorizeHeader text = "\ESC[32m" <> text <> "\ESC[0m" - -colorizeWarningHeader :: String -> String -colorizeWarningHeader text = "\ESC[31m" <> text <> "\ESC[0m" - -colorizeUsageHeader :: String -> String -colorizeUsageHeader = T.unpack . T.replace (T.pack "Usage:") (T.pack $ colorizeHeader "Usage:") . T.pack - -colorizeExamplesHeader :: String -> String -colorizeExamplesHeader = T.unpack . T.replace (T.pack "Examples:") (T.pack $ colorizeHeader "Examples:") . T.pack - parseBuildCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseBuildCommand invokedName cmdArgs = case O.execParserPure O.defaultPrefs (buildParserInfo invokedName) cmdArgs of @@ -381,7 +269,7 @@ parseBuildCommand invokedName cmdArgs = O.Failure failure -> let (msg, exitCode) = O.renderFailure failure ("cabal " ++ invokedName) in if exitCode == ExitSuccess - then CommandHelp (buildHelpText invokedName) + then CommandHelp (CommandUIOpt.helpText replaceBuildAlias buildCommand invokedName) else CommandErrors [msg] O.CompletionInvoked _ -> CommandErrors ["Shell completion is not supported by this parser path."] diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs index 5a879ee6b1a..29c0fd96db5 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -17,6 +17,7 @@ module Distribution.Client.CommandUIOptParse , getOptToColumns , wrapDescription , capitalizeDescription + , helpText -- * Option grouping helpers , groupPredicates @@ -26,6 +27,7 @@ module Distribution.Client.CommandUIOptParse import Distribution.Client.Compat.Prelude import Prelude () +import qualified Data.Text as T import Data.Char (isLower) import Data.List (mapAccumL) import Data.Monoid (Endo (..)) @@ -35,6 +37,8 @@ import Distribution.ReadE (runReadE) import Distribution.Simple.Command ( OptDescr (..) , OptionField (..) + , ShowOrParseArgs (ShowArgs) + , CommandUI (..) ) import Distribution.Client.NixStyleOptions ( keepBenchOptions @@ -55,6 +59,7 @@ import Distribution.Client.NixStyleOptions , keepSolvingOptions , keepTestOptions , keepUnsupportedOptions + , NixStyleFlags(..) ) import qualified Options.Applicative as O @@ -272,3 +277,104 @@ groupPredicates = , ("Include and linker path options", keepIncludeOptions) , ("Program override options", keepProgOptions) ] + +type ReplaceCommandAlias = String -> String -> String + +helpText :: ReplaceCommandAlias -> CommandUI (NixStyleFlags a) -> String -> String -> String +helpText replaceBuildAlias buildCommand invokedName pname = + commandSynopsis buildCommand + <> "\n\n" + <> colorizeUsageHeader (replaceBuildAlias invokedName (commandUsage buildCommand pname)) + <> maybe "" (('\n' :) . ($ pname)) (commandDescription buildCommand) + <> "\n" + <> colorizeHeader "Flags for build:" + <> "\n" + <> ungroupedRows + <> groupedRows + <> warningSection + <> maybe "" (('\n' :) . colorizeExamplesHeader . replaceBuildAlias invokedName . ($ pname)) (commandNotes buildCommand) + where + commonHelpOptions :: [GetOpt.OptDescr ()] + commonHelpOptions = + [GetOpt.Option ['h'] ["help"] (GetOpt.NoArg ()) "Show this help text"] + + maxFlagColumnWidth :: Int + maxFlagColumnWidth = 30 + + helpOutputWidth :: Int + helpOutputWidth = 100 + + allOptions :: [GetOpt.OptDescr ()] + allOptions = + commonHelpOptions + ++ concatMap optionFieldToGetOpt optsUngrouped + ++ concatMap (concatMap optionFieldToGetOpt . snd) optsGrouped + + descColumn :: Int + descColumn = + min + maxFlagColumnWidth + ( maximum + ( 0 + : map + (length . fst . getOptToColumns) + allOptions + ) + ) + + 2 + + (ungroupedRows, ungroupedWarnings) = + renderOptionRows + colorizeWarningHeader + maxFlagColumnWidth + descColumn + helpOutputWidth + (commonHelpOptions ++ concatMap optionFieldToGetOpt optsUngrouped) + + renderedGroups = map renderGroup optsGrouped + + groupedRows = concatMap fst renderedGroups + + groupedWarnings = concatMap snd renderedGroups + + warningSection = + case ungroupedWarnings ++ groupedWarnings of + [] -> "" + warnings -> + "\n" + <> colorizeWarningHeader "Warnings:" + <> "\n" + <> concat [" - " <> warning <> "\n" | warning <- warnings] + + renderGroup :: (String, [OptionField a]) -> (String, [String]) + renderGroup (title, options) + | null options = ("", []) + | otherwise = + let (rows, warnings) = + renderOptionRows + colorizeWarningHeader + maxFlagColumnWidth + descColumn + helpOutputWidth + (concatMap optionFieldToGetOpt options) + in ( "\n" + <> colorizeHeader (title <> ":") + <> "\n" + <> rows + , warnings + ) + + (optsGrouped, optsUngrouped) = + groupSequentially (commandOptions buildCommand ShowArgs) groupPredicates + +colorizeHeader :: String -> String +colorizeHeader text = "\ESC[32m" <> text <> "\ESC[0m" + +colorizeWarningHeader :: String -> String +colorizeWarningHeader text = "\ESC[31m" <> text <> "\ESC[0m" + +colorizeUsageHeader :: String -> String +colorizeUsageHeader = T.unpack . T.replace (T.pack "Usage:") (T.pack $ colorizeHeader "Usage:") . T.pack + +colorizeExamplesHeader :: String -> String +colorizeExamplesHeader = T.unpack . T.replace (T.pack "Examples:") (T.pack $ colorizeHeader "Examples:") . T.pack From c38079a9277587de3bfb769c4d5c6b3f1aed6ca2 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 10:40:46 -0400 Subject: [PATCH 028/104] Move examples --- .../src/Distribution/Client/CmdBuild.hs | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 3533968ff80..699ac19c9f3 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -115,6 +115,22 @@ buildCommand = ) } +examples :: String -> String +examples invokedName = + unlines + [ "Examples:" + , " - " <> invokedName + , " Build the package in the current directory or all packages in the project" + , " - " <> invokedName <> " pkgname" + , " Build the package named pkgname in the project" + , " - " <> invokedName <> " ./pkgfoo" + , " Build the package in the ./pkgfoo directory" + , " - " <> invokedName <> " cname" + , " Build the component named cname in the project" + , " - " <> invokedName <> " cname --enable-profiling" + , " Build the component in profiling mode (including dependencies as needed)" + ] + data BuildFlags = BuildFlags { buildOnlyConfigure :: Flag Bool } @@ -281,7 +297,7 @@ buildParserInfo invokedName = ( O.fullDesc <> O.progDesc buildHelpDescription <> O.header ("cabal " ++ invokedName) - <> O.footer (buildExamplesSection invokedName) + <> O.footer (examples invokedName) ) buildHelpDescription :: String @@ -290,22 +306,6 @@ buildHelpDescription = Nothing -> commandSynopsis buildCommand Just mkDescription -> mkDescription "cabal" -buildExamplesSection :: String -> String -buildExamplesSection invokedName = - unlines - [ "Examples:" - , " - " <> invokedName - , " Build the package in the current directory or all packages in the project" - , " - " <> invokedName <> " pkgname" - , " Build the package named pkgname in the project" - , " - " <> invokedName <> " ./pkgfoo" - , " Build the package in the ./pkgfoo directory" - , " - " <> invokedName <> " cname" - , " Build the component named cname in the project" - , " - " <> invokedName <> " cname --enable-profiling" - , " Build the component in profiling mode (including dependencies as needed)" - ] - data ParsedBuildCommand = ParsedBuildCommand { parsedFlagEdits :: Endo (NixStyleFlags BuildFlags) , parsedTargets :: [String] From ba11f16b8d5e541dffe0f0f05577c6a9a52bad54 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 10:47:02 -0400 Subject: [PATCH 029/104] Use the examples --- .../src/Distribution/Client/CmdBuild.hs | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 699ac19c9f3..ed7050a3501 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -75,30 +75,7 @@ buildCommand = ++ "configuration flags can be specified on the command line and these " ++ "extend the project configuration from the 'cabal.project', " ++ "'cabal.project.local' and other files." - , commandNotes = Just $ \pname -> - "Examples:\n" - ++ " - " - ++ pname - ++ " v2-build\n" - ++ " Build the package in the current directory " - ++ "or all packages in the project\n" - ++ " - " - ++ pname - ++ " v2-build pkgname\n" - ++ " Build the package named pkgname in the project\n" - ++ " - " - ++ pname - ++ " v2-build ./pkgfoo\n" - ++ " Build the package in the ./pkgfoo directory\n" - ++ " - " - ++ pname - ++ " v2-build cname\n" - ++ " Build the component named cname in the project\n" - ++ " - " - ++ pname - ++ " v2-build cname --enable-profiling\n" - ++ " Build the component in profiling mode " - ++ "(including dependencies as needed)\n" + , commandNotes = Just examples , commandDefaultFlags = defaultNixStyleFlags defaultBuildFlags , commandOptions = removeIgnoreProjectOption From 126ca795e5a8566e719352bb267f58ca2ecbf3fd Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 10:49:08 -0400 Subject: [PATCH 030/104] Separate description --- .../src/Distribution/Client/CmdBuild.hs | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index ed7050a3501..bf3c4452891 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -63,18 +63,7 @@ buildCommand = { commandName = "v2-build" , commandSynopsis = "Compile targets within the project." , commandUsage = usageAlternatives "v2-build" ["[TARGETS] [FLAGS]"] - , commandDescription = Just $ \_ -> - wrapText $ - "Build one or more targets from within the project. The available " - ++ "targets are the packages in the project as well as individual " - ++ "components within those packages, including libraries, executables, " - ++ "test-suites or benchmarks. Targets can be specified by name or " - ++ "location. If no target is specified then the default is to build " - ++ "the package in the current directory.\n\n" - ++ "Dependencies are built or rebuilt as necessary. Additional " - ++ "configuration flags can be specified on the command line and these " - ++ "extend the project configuration from the 'cabal.project', " - ++ "'cabal.project.local' and other files." + , commandDescription = Just $ \_ -> wrapText description , commandNotes = Just examples , commandDefaultFlags = defaultNixStyleFlags defaultBuildFlags , commandOptions = @@ -92,6 +81,19 @@ buildCommand = ) } +description :: String +description = + "Build one or more targets from within the project. The available " + ++ "targets are the packages in the project as well as individual " + ++ "components within those packages, including libraries, executables, " + ++ "test-suites or benchmarks. Targets can be specified by name or " + ++ "location. If no target is specified then the default is to build " + ++ "the package in the current directory.\n\n" + ++ "Dependencies are built or rebuilt as necessary. Additional " + ++ "configuration flags can be specified on the command line and these " + ++ "extend the project configuration from the 'cabal.project', " + ++ "'cabal.project.local' and other files." + examples :: String -> String examples invokedName = unlines From 13484c1ff050b6a9a75fd63ca2f351ce48d6a67c Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 10:55:13 -0400 Subject: [PATCH 031/104] Use fmap . fmap --- cabal-install/src/Distribution/Client/CmdBuild.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index bf3c4452891..c4cec93369d 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -326,4 +326,6 @@ buildItemParser = buildOptionParsers :: [O.Parser BuildItem] buildOptionParsers = - map (BuildItemFlag <$>) (CommandUIOpt.optionFieldFlagParsers (commandOptions buildCommand ParseArgs)) + (fmap . fmap) + BuildItemFlag + (CommandUIOpt.optionFieldFlagParsers $ commandOptions buildCommand ParseArgs) From df7f48b75710c9c4ba190b0164377b250abe428a Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 11:42:54 -0400 Subject: [PATCH 032/104] Don't reference buildCommand --- cabal-install/src/Distribution/Client/CmdHaddockProject.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdHaddockProject.hs b/cabal-install/src/Distribution/Client/CmdHaddockProject.hs index 2b0caff2262..a828cef6f23 100644 --- a/cabal-install/src/Distribution/Client/CmdHaddockProject.hs +++ b/cabal-install/src/Distribution/Client/CmdHaddockProject.hs @@ -133,7 +133,7 @@ haddockProjectAction flags _extraArgs globalFlags = do verbosity RejectNoTargets Nothing - (commandDefaultFlags CmdBuild.buildCommand) + buildDefaultFlags ["all"] globalFlags HaddockCommand @@ -199,7 +199,7 @@ haddockProjectAction flags _extraArgs globalFlags = do when localStyle $ CmdBuild.buildAction - (commandDefaultFlags CmdBuild.buildCommand) + buildDefaultFlags ["all"] globalFlags @@ -362,6 +362,7 @@ haddockProjectAction flags _extraArgs globalFlags = do where -- build all packages with appropriate haddock flags commonFlags = haddockProjectCommonFlags flags + buildDefaultFlags = NixStyleOptions.defaultNixStyleFlags CmdBuild.defaultBuildFlags verbosity = mkVerbosity defaultVerbosityHandles $ @@ -413,7 +414,7 @@ haddockProjectAction flags _extraArgs globalFlags = do (commandDefaultFlags CmdHaddock.haddockCommand) { NixStyleOptions.haddockFlags = haddockFlags , NixStyleOptions.configFlags = - (NixStyleOptions.configFlags (commandDefaultFlags CmdBuild.buildCommand)) + (NixStyleOptions.configFlags buildDefaultFlags) { configCommonFlags = commonFlags } } From aafa5941a0a72e39bcc81bee34bd9e7420c8f38c Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 11:43:25 -0400 Subject: [PATCH 033/104] Add cmdSpec --- .../src/Distribution/Client/CmdBuild.hs | 33 ++++++++++++++++++- cabal-install/src/Distribution/Client/Main.hs | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index c4cec93369d..2eeef46026b 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -1,7 +1,10 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RecordWildCards #-} + -- | cabal-install CLI command: build module Distribution.Client.CmdBuild ( -- * The @build@ CLI and action - buildCommand + cmdSpec , buildAction , parseBuildCommand , isBuildCommandName @@ -47,7 +50,10 @@ import Distribution.Client.Setup (GlobalFlags, yesNoOpt) import Distribution.Simple.Command ( CommandParse (..) , CommandUI (..) + , CommandSpec (..) , ShowOrParseArgs (ParseArgs) + , CommandType (..) + , commandAddAction , commandParseArgs , option , usageAlternatives @@ -57,6 +63,31 @@ import Distribution.Simple.Utils (dieWithException, wrapText) import Distribution.Verbosity (normal) import qualified Options.Applicative as O +cmdSpec :: [CommandSpec (GlobalFlags -> IO ())] +cmdSpec = [cmd defaultUi, cmd newUi, cmd origUi] + where + origUi@CommandUI{..} = buildCommand + + cmd ui = CommandSpec ui (`commandAddAction` buildAction) NormalCommand + + newMsg = T.unpack . T.replace "v2-" "new-" . T.pack + newUi = + origUi + { commandName = newMsg commandName + , commandUsage = newMsg . commandUsage + , commandDescription = (newMsg .) <$> commandDescription + , commandNotes = (newMsg .) <$> commandNotes + } + + defaultMsg = T.unpack . T.replace "v2-" "" . T.pack + defaultUi = + origUi + { commandName = defaultMsg commandName + , commandUsage = defaultMsg . commandUsage + , commandDescription = (defaultMsg .) <$> commandDescription + , commandNotes = (defaultMsg .) <$> commandNotes + } + buildCommand :: CommandUI (NixStyleFlags BuildFlags) buildCommand = CommandUI diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index 10b26ff43f5..9d78aab1457 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -498,7 +498,7 @@ mainWorker args = do ++ concat [ newCmd CmdConfigure.configureCommand CmdConfigure.configureAction , newCmd CmdUpdate.updateCommand CmdUpdate.updateAction - , newCmd CmdBuild.buildCommand CmdBuild.buildAction + , CmdBuild.cmdSpec , newCmd CmdRepl.replCommand CmdRepl.replAction , newCmd CmdFreeze.freezeCommand CmdFreeze.freezeAction , newCmd CmdHaddock.haddockCommand CmdHaddock.haddockAction From a671363f54232229c147d0e9412f55134642c683 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 12:15:48 -0400 Subject: [PATCH 034/104] Follow hlint suggestion: use list comprehension --- cabal-install/src/Distribution/Client/CommandUIOptParse.hs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs index 29c0fd96db5..b739e97eacc 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -149,10 +149,7 @@ renderOptionRows colorizeWarning maxFlagColumnWidth descColumn helpOutputWidth o else wrappedDescription isStacked = length flagColumn > maxFlagColumnWidth spacer = if isStacked && not isFirstInGroup then "\n" else "" - warning = - if wasAutoCapitalized - then ["Auto-capitalized help text for " <> flagColumn] - else [] + warning = ["Auto-capitalized help text for " <> flagColumn | wasAutoCapitalized] renderedRow = spacer <> if isStacked From 05e8bbf372e49c3c76e84e8963416ebeff04ad0a Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 12:29:31 -0400 Subject: [PATCH 035/104] Don't import Options.Applicative qualified --- .../src/Distribution/Client/CmdBuild.hs | 66 ++++++++++++------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 2eeef46026b..d37227540d8 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -49,10 +49,10 @@ import Distribution.Client.ScriptUtils import Distribution.Client.Setup (GlobalFlags, yesNoOpt) import Distribution.Simple.Command ( CommandParse (..) - , CommandUI (..) , CommandSpec (..) - , ShowOrParseArgs (ParseArgs) , CommandType (..) + , CommandUI (..) + , ShowOrParseArgs (ParseArgs) , commandAddAction , commandParseArgs , option @@ -61,7 +61,27 @@ import Distribution.Simple.Command import Distribution.Simple.Flag (Flag, fromFlag, toFlag) import Distribution.Simple.Utils (dieWithException, wrapText) import Distribution.Verbosity (normal) -import qualified Options.Applicative as O +import Options.Applicative + ( Parser + , ParserInfo + , ParserResult (..) + , asum + , defaultPrefs + , execParserPure + , flag' + , footer + , fullDesc + , header + , help + , helper + , info + , long + , metavar + , progDesc + , renderFailure + , strArgument + , (<**>) + ) cmdSpec :: [CommandSpec (GlobalFlags -> IO ())] cmdSpec = [cmd defaultUi, cmd newUi, cmd origUi] @@ -285,29 +305,29 @@ replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack parseBuildCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseBuildCommand invokedName cmdArgs = - case O.execParserPure O.defaultPrefs (buildParserInfo invokedName) cmdArgs of - O.Success parsed -> + case execParserPure defaultPrefs (buildParserInfo invokedName) cmdArgs of + Success parsed -> if parsedListOptions parsed then CommandList buildListOptions else let flags = appEndo (parsedFlagEdits parsed) (commandDefaultFlags buildCommand) in CommandReadyToGo (buildAction flags (parsedTargets parsed)) - O.Failure failure -> - let (msg, exitCode) = O.renderFailure failure ("cabal " ++ invokedName) + Failure failure -> + let (msg, exitCode) = renderFailure failure ("cabal " ++ invokedName) in if exitCode == ExitSuccess then CommandHelp (CommandUIOpt.helpText replaceBuildAlias buildCommand invokedName) else CommandErrors [msg] - O.CompletionInvoked _ -> + CompletionInvoked _ -> CommandErrors ["Shell completion is not supported by this parser path."] -buildParserInfo :: String -> O.ParserInfo ParsedBuildCommand +buildParserInfo :: String -> ParserInfo ParsedBuildCommand buildParserInfo invokedName = - O.info - (parsedBuildCommandParser O.<**> O.helper) - ( O.fullDesc - <> O.progDesc buildHelpDescription - <> O.header ("cabal " ++ invokedName) - <> O.footer (examples invokedName) + info + (parsedBuildCommandParser <**> helper) + ( fullDesc + <> progDesc buildHelpDescription + <> header ("cabal " ++ invokedName) + <> footer (examples invokedName) ) buildHelpDescription :: String @@ -327,8 +347,8 @@ data BuildItem | BuildItemTarget String | BuildItemListOptions -parsedBuildCommandParser :: O.Parser ParsedBuildCommand -parsedBuildCommandParser = toParsed <$> O.many buildItemParser +parsedBuildCommandParser :: Parser ParsedBuildCommand +parsedBuildCommandParser = toParsed <$> many buildItemParser where toParsed items = let edits = [e | BuildItemFlag e <- items] @@ -343,19 +363,19 @@ parsedBuildCommandParser = toParsed <$> O.many buildItemParser isListOptions BuildItemListOptions = True isListOptions _ = False -buildItemParser :: O.Parser BuildItem +buildItemParser :: Parser BuildItem buildItemParser = - O.asum + asum ( buildOptionParsers ++ [ BuildItemListOptions - <$ O.flag' + <$ flag' () - (O.long "list-options" <> O.help "Print a list of command line flags") - , BuildItemTarget <$> O.strArgument (O.metavar "TARGET") + (long "list-options" <> help "Print a list of command line flags") + , BuildItemTarget <$> strArgument (metavar "TARGET") ] ) -buildOptionParsers :: [O.Parser BuildItem] +buildOptionParsers :: [Parser BuildItem] buildOptionParsers = (fmap . fmap) BuildItemFlag From dd3ff6d1569546c983d84c02d0fa5eb36feaf402 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 13:09:49 -0400 Subject: [PATCH 036/104] examples taking a program name --- .../src/Distribution/Client/CmdBuild.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index d37227540d8..ab9b45ead9e 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -115,7 +115,7 @@ buildCommand = , commandSynopsis = "Compile targets within the project." , commandUsage = usageAlternatives "v2-build" ["[TARGETS] [FLAGS]"] , commandDescription = Just $ \_ -> wrapText description - , commandNotes = Just examples + , commandNotes = Just $ \pname -> examples pname "v2-build" , commandDefaultFlags = defaultNixStyleFlags defaultBuildFlags , commandOptions = removeIgnoreProjectOption @@ -145,19 +145,19 @@ description = ++ "extend the project configuration from the 'cabal.project', " ++ "'cabal.project.local' and other files." -examples :: String -> String -examples invokedName = +examples :: String -> String -> String +examples pname invokedName = unlines [ "Examples:" - , " - " <> invokedName + , " - " <> pname <> " " <> invokedName , " Build the package in the current directory or all packages in the project" - , " - " <> invokedName <> " pkgname" + , " - " <> pname <> " " <> invokedName <> " pkgname" , " Build the package named pkgname in the project" - , " - " <> invokedName <> " ./pkgfoo" + , " - " <> pname <> " " <> invokedName <> " ./pkgfoo" , " Build the package in the ./pkgfoo directory" - , " - " <> invokedName <> " cname" + , " - " <> pname <> " " <> invokedName <> " cname" , " Build the component named cname in the project" - , " - " <> invokedName <> " cname --enable-profiling" + , " - " <> pname <> " " <> invokedName <> " cname --enable-profiling" , " Build the component in profiling mode (including dependencies as needed)" ] @@ -327,7 +327,7 @@ buildParserInfo invokedName = ( fullDesc <> progDesc buildHelpDescription <> header ("cabal " ++ invokedName) - <> footer (examples invokedName) + <> footer (examples "cabal" invokedName) ) buildHelpDescription :: String From 9fbff5820243940b77c929709bee8076492852c7 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 15:34:26 -0400 Subject: [PATCH 037/104] Simplify cmdSpec --- .../src/Distribution/Client/CmdBuild.hs | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index ab9b45ead9e..2e295c1650c 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -84,24 +84,13 @@ import Options.Applicative ) cmdSpec :: [CommandSpec (GlobalFlags -> IO ())] -cmdSpec = [cmd defaultUi, cmd newUi, cmd origUi] +cmdSpec = [CommandSpec ui (`commandAddAction` buildAction) NormalCommand] where - origUi@CommandUI{..} = buildCommand - - cmd ui = CommandSpec ui (`commandAddAction` buildAction) NormalCommand - - newMsg = T.unpack . T.replace "v2-" "new-" . T.pack - newUi = - origUi - { commandName = newMsg commandName - , commandUsage = newMsg . commandUsage - , commandDescription = (newMsg .) <$> commandDescription - , commandNotes = (newMsg .) <$> commandNotes - } - defaultMsg = T.unpack . T.replace "v2-" "" . T.pack - defaultUi = - origUi + CommandUI{..} = buildCommand + + ui = + buildCommand { commandName = defaultMsg commandName , commandUsage = defaultMsg . commandUsage , commandDescription = (defaultMsg .) <$> commandDescription From a4348925308bcaa7cf3aa112ac43dc8d3a06b287 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 21:01:47 -0400 Subject: [PATCH 038/104] Group --enable-* with --disable-* --- Cabal/src/Distribution/Simple/Command.hs | 31 ++++++++++++++----- .../Distribution/Client/CommandUIOptParse.hs | 17 ++++++++-- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Command.hs b/Cabal/src/Distribution/Simple/Command.hs index d3cff2db4e8..e140b2d4186 100644 --- a/Cabal/src/Distribution/Simple/Command.hs +++ b/Cabal/src/Distribution/Simple/Command.hs @@ -340,10 +340,10 @@ commandGetOpts -> CommandUI flags -> [GetOpt.OptDescr (flags -> flags)] commandGetOpts showOrParse command = - concatMap viewAsGetOpt (commandOptions command showOrParse) + concatMap (viewAsGetOpt showOrParse) (commandOptions command showOrParse) -viewAsGetOpt :: OptionField a -> [GetOpt.OptDescr (a -> a)] -viewAsGetOpt (OptionField _n aa) = concatMap optDescrToGetOpt aa +viewAsGetOpt :: ShowOrParseArgs -> OptionField a -> [GetOpt.OptDescr (a -> a)] +viewAsGetOpt showOrParse (OptionField _n aa) = concatMap optDescrToGetOpt aa where optDescrToGetOpt (ReqArg d (cs, ss) arg_desc set _) = [GetOpt.Option cs ss (GetOpt.ReqArg (runReadE set) arg_desc) d] @@ -358,10 +358,27 @@ viewAsGetOpt (OptionField _n aa) = concatMap optDescrToGetOpt aa [GetOpt.Option sfT lfT (GetOpt.NoArg (set True)) d] optDescrToGetOpt (BoolOpt d ([], []) (sfF, lfF) set _) = [GetOpt.Option sfF lfF (GetOpt.NoArg (set False)) d] - optDescrToGetOpt (BoolOpt d (sfT, lfT) (sfF, lfF) set _) = - [ GetOpt.Option sfT lfT (GetOpt.NoArg (set True)) ("Enable " ++ d) - , GetOpt.Option sfF lfF (GetOpt.NoArg (set False)) ("Disable " ++ d) - ] + optDescrToGetOpt (BoolOpt d trueFlags@(sfT, lfT) falseFlags@(sfF, lfF) set _) = + case showOrParse of + ShowArgs + | Just groupedLongFlag <- mkGroupedBoolLongFlag trueFlags falseFlags -> + [ GetOpt.Option [] [groupedLongFlag] (GetOpt.NoArg (set True)) ("Enable or disable " ++ d) + ] + _ -> + [ GetOpt.Option sfT lfT (GetOpt.NoArg (set True)) ("Enable " ++ d) + , GetOpt.Option sfF lfF (GetOpt.NoArg (set False)) ("Disable " ++ d) + ] + + mkGroupedBoolLongFlag :: OptFlags -> OptFlags -> Maybe String + mkGroupedBoolLongFlag ([], [longA]) ([], [longB]) = + checkPair longA longB <|> checkPair longB longA + where + checkPair longEnable longDisable = do + suffixEnable <- List.stripPrefix "enable-" longEnable + suffixDisable <- List.stripPrefix "disable-" longDisable + guard (suffixEnable == suffixDisable) + pure ("[enable|disable]-" ++ suffixEnable) + mkGroupedBoolLongFlag _ _ = Nothing getCurrentChoice :: OptDescr a -> a -> [String] getCurrentChoice (ChoiceOpt alts) a = diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs index b739e97eacc..07e05e1f076 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -29,7 +29,7 @@ import Prelude () import qualified Data.Text as T import Data.Char (isLower) -import Data.List (mapAccumL) +import Data.List (mapAccumL, stripPrefix) import Data.Monoid (Endo (..)) import qualified System.Console.GetOpt as GetOpt @@ -119,16 +119,29 @@ optDescrToGetOpt = \case [ GetOpt.Option shortFlags longFlags (GetOpt.NoArg ()) desc | (desc, (shortFlags, longFlags), _setFn, _getFn) <- choices ] - BoolOpt desc (shortTrue, longTrue) (shortFalse, longFalse) _setFn _getFn + BoolOpt desc trueFlags@(shortTrue, longTrue) falseFlags@(shortFalse, longFalse) _setFn _getFn | null shortFalse && null longFalse -> [GetOpt.Option shortTrue longTrue (GetOpt.NoArg ()) desc] | null shortTrue && null longTrue -> [GetOpt.Option shortFalse longFalse (GetOpt.NoArg ()) desc] + | Just groupedLongFlag <- mkGroupedBoolLongFlag trueFlags falseFlags -> + [GetOpt.Option [] [groupedLongFlag] (GetOpt.NoArg ()) ("Enable or disable " <> desc)] | otherwise -> [ GetOpt.Option shortTrue longTrue (GetOpt.NoArg ()) ("Enable " <> desc) , GetOpt.Option shortFalse longFalse (GetOpt.NoArg ()) ("Disable " <> desc) ] +mkGroupedBoolLongFlag :: (String, [String]) -> (String, [String]) -> Maybe String +mkGroupedBoolLongFlag ([], [longA]) ([], [longB]) = + checkPair longA longB <|> checkPair longB longA + where + checkPair longEnable longDisable = do + suffixEnable <- stripPrefix "enable-" longEnable + suffixDisable <- stripPrefix "disable-" longDisable + guard (suffixEnable == suffixDisable) + pure ("[enable|disable]-" <> suffixEnable) +mkGroupedBoolLongFlag _ _ = Nothing + renderOptionRows :: (String -> String) -> Int -> Int -> Int -> [GetOpt.OptDescr ()] -> (String, [String]) renderOptionRows colorizeWarning maxFlagColumnWidth descColumn helpOutputWidth options = let rendered = [renderOption (index == 0) opt | (index, opt) <- zip [0 :: Int ..] options] From 2d73b8b9f7d34249e1788bca4edfecd74833ea74 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 21:14:23 -0400 Subject: [PATCH 039/104] Use "Toggle" instead of "Enable or disable" --- Cabal/src/Distribution/Simple/Command.hs | 2 +- cabal-install/src/Distribution/Client/CommandUIOptParse.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Command.hs b/Cabal/src/Distribution/Simple/Command.hs index e140b2d4186..a92cc1b019c 100644 --- a/Cabal/src/Distribution/Simple/Command.hs +++ b/Cabal/src/Distribution/Simple/Command.hs @@ -362,7 +362,7 @@ viewAsGetOpt showOrParse (OptionField _n aa) = concatMap optDescrToGetOpt aa case showOrParse of ShowArgs | Just groupedLongFlag <- mkGroupedBoolLongFlag trueFlags falseFlags -> - [ GetOpt.Option [] [groupedLongFlag] (GetOpt.NoArg (set True)) ("Enable or disable " ++ d) + [ GetOpt.Option [] [groupedLongFlag] (GetOpt.NoArg (set True)) ("Toggle " ++ d) ] _ -> [ GetOpt.Option sfT lfT (GetOpt.NoArg (set True)) ("Enable " ++ d) diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs index 07e05e1f076..25f21d5b936 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -125,7 +125,7 @@ optDescrToGetOpt = \case | null shortTrue && null longTrue -> [GetOpt.Option shortFalse longFalse (GetOpt.NoArg ()) desc] | Just groupedLongFlag <- mkGroupedBoolLongFlag trueFlags falseFlags -> - [GetOpt.Option [] [groupedLongFlag] (GetOpt.NoArg ()) ("Enable or disable " <> desc)] + [GetOpt.Option [] [groupedLongFlag] (GetOpt.NoArg ()) ("Toggle " <> desc)] | otherwise -> [ GetOpt.Option shortTrue longTrue (GetOpt.NoArg ()) ("Enable " <> desc) , GetOpt.Option shortFalse longFalse (GetOpt.NoArg ()) ("Disable " <> desc) From ecf96f7e6b239c0db7d535574db6ee349de86e8f Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Wed, 5 Aug 2026 21:29:54 -0400 Subject: [PATCH 040/104] Use optparse-applicative with CmdInstall --- .../src/Distribution/Client/CmdInstall.hs | 161 +++++++++++++++++- cabal-install/src/Distribution/Client/Main.hs | 11 +- 2 files changed, 166 insertions(+), 6 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 1215af9fc7b..1e37dda63c6 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -5,8 +5,11 @@ -- | cabal-install CLI command: install module Distribution.Client.CmdInstall ( -- * The @install@ CLI and action - installCommand + cmdSpec + , installCommand , installAction + , parseInstallCommand + , isInstallCommandName -- * Internals exposed for testing , selectPackageTargets @@ -117,8 +120,15 @@ import Distribution.Package import Distribution.Simple.BuildPaths ( exeExtension ) +import qualified Distribution.Client.CommandUIOptParse as CommandUIOpt import Distribution.Simple.Command - ( CommandUI (..) + ( CommandParse (..) + , CommandSpec (..) + , CommandType (..) + , CommandUI (..) + , ShowOrParseArgs (ParseArgs) + , commandAddAction + , commandParseArgs , optionName , usageAlternatives ) @@ -219,6 +229,8 @@ import Distribution.Verbosity import qualified Data.ByteString.Lazy.Char8 as BS import qualified Data.List.NonEmpty as NE import qualified Data.Map as Map +import Data.Monoid (Endo (..), appEndo) +import qualified Data.Text as T import Data.Ord ( Down (..) ) @@ -228,6 +240,27 @@ import Distribution.Utils.NubList ( fromNubList ) import Network.URI (URI) +import Options.Applicative + ( Parser + , ParserInfo + , ParserResult (..) + , asum + , defaultPrefs + , execParserPure + , flag' + , footer + , fullDesc + , header + , help + , helper + , info + , long + , metavar + , progDesc + , renderFailure + , strArgument + , (<**>) + ) import System.Directory ( copyFile , createDirectoryIfMissing @@ -285,6 +318,20 @@ data InstallExe = InstallExe -- store. } +cmdSpec :: [CommandSpec (GlobalFlags -> IO ())] +cmdSpec = [CommandSpec ui (`commandAddAction` installAction) NormalCommand] + where + defaultMsg = T.unpack . T.replace (T.pack "v2-") (T.pack "") . T.pack + CommandUI{..} = installCommand + + ui = + installCommand + { commandName = defaultMsg commandName + , commandUsage = defaultMsg . commandUsage + , commandDescription = (defaultMsg .) <$> commandDescription + , commandNotes = (defaultMsg .) <$> commandNotes + } + installCommand :: CommandUI (NixStyleFlags ClientInstallFlags) installCommand = CommandUI @@ -1389,3 +1436,113 @@ reportBuildTargetProblems verbosity problems = reportTargetProblems verbosity "b reportCannotPruneDependencies :: Verbosity -> CannotPruneDependencies -> IO a reportCannotPruneDependencies verbosity = dieWithException verbosity . SelectComponentTargetError . renderCannotPruneDependencies + +-- | The command name and aliases for the @install@ command. +-- +-- >>> installCommandNames +-- ["install","new-install","v2-install"] +installCommandNames :: [String] +installCommandNames = ["install", "new-install", commandName installCommand] + +isInstallCommandName :: String -> Bool +isInstallCommandName name = name `elem` installCommandNames + +installListOptions :: [String] +installListOptions = + case commandParseArgs installCommand False ["--list-options"] of + CommandList opts -> opts + _ -> [] + +replaceInstallAlias :: String -> String -> String +replaceInstallAlias invokedName = + T.unpack . T.replace (T.pack "v2-install") (T.pack invokedName) . T.pack + +parseInstallCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) +parseInstallCommand invokedName cmdArgs = + case execParserPure defaultPrefs (installParserInfo invokedName) cmdArgs of + Success parsed -> + if parsedListOptions parsed + then CommandList installListOptions + else + let flags = appEndo (parsedFlagEdits parsed) (commandDefaultFlags installCommand) + in CommandReadyToGo (installAction flags (parsedTargets parsed)) + Failure failure -> + let (msg, exitCode) = renderFailure failure ("cabal " ++ invokedName) + in if exitCode == ExitSuccess + then CommandHelp (CommandUIOpt.helpText replaceInstallAlias installCommand invokedName) + else CommandErrors [msg] + CompletionInvoked _ -> + CommandErrors ["Shell completion is not supported by this parser path."] + +installParserInfo :: String -> ParserInfo ParsedInstallCommand +installParserInfo invokedName = + info + (parsedInstallCommandParser <**> helper) + ( fullDesc + <> progDesc installHelpDescription + <> header ("cabal " ++ invokedName) + <> footer (installExamples invokedName) + ) + +installHelpDescription :: String +installHelpDescription = + case commandDescription installCommand of + Nothing -> commandSynopsis installCommand + Just mkDescription -> mkDescription "cabal" + +installExamples :: String -> String +installExamples invokedName = + unlines + [ "Examples:" + , " - cabal " <> invokedName + , " Install the package in the current directory" + , " - cabal " <> invokedName <> " pkgname" + , " Install the package named pkgname (fetching it from hackage if necessary)" + , " - cabal " <> invokedName <> " ./pkgfoo" + , " Install the package in the ./pkgfoo directory" + ] + +data ParsedInstallCommand = ParsedInstallCommand + { parsedFlagEdits :: Endo (NixStyleFlags ClientInstallFlags) + , parsedTargets :: [String] + , parsedListOptions :: Bool + } + +data InstallItem + = InstallItemFlag (Endo (NixStyleFlags ClientInstallFlags)) + | InstallItemTarget String + | InstallItemListOptions + +parsedInstallCommandParser :: Parser ParsedInstallCommand +parsedInstallCommandParser = toParsed <$> many installItemParser + where + toParsed items = + let edits = [e | InstallItemFlag e <- items] + targets = [t | InstallItemTarget t <- items] + listOptionsSeen = any isListOptions items + in ParsedInstallCommand + { parsedFlagEdits = mconcat edits + , parsedTargets = targets + , parsedListOptions = listOptionsSeen + } + + isListOptions InstallItemListOptions = True + isListOptions _ = False + +installItemParser :: Parser InstallItem +installItemParser = + asum + ( installOptionParsers + ++ [ InstallItemListOptions + <$ flag' + () + (long "list-options" <> help "Print a list of command line flags") + , InstallItemTarget <$> strArgument (metavar "TARGET") + ] + ) + +installOptionParsers :: [Parser InstallItem] +installOptionParsers = + (fmap . fmap) + InstallItemFlag + (CommandUIOpt.optionFieldFlagParsers $ commandOptions installCommand ParseArgs) diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index 9d78aab1457..b4bf4b3fd31 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -380,12 +380,12 @@ mainWorker args = do where commandsRunBuildOptparseFirst :: [String] -> IO (CommandParse (GlobalFlags, CommandParse Action)) commandsRunBuildOptparseFirst argv = - case parseBuildWithOptparse argv of + case parseBuildOrInstallWithOptparse argv of Just parsed -> pure parsed Nothing -> commandsRunWithFallback globalCmd commands delegateToExternal argv - parseBuildWithOptparse :: [String] -> Maybe (CommandParse (GlobalFlags, CommandParse Action)) - parseBuildWithOptparse argv = + parseBuildOrInstallWithOptparse :: [String] -> Maybe (CommandParse (GlobalFlags, CommandParse Action)) + parseBuildOrInstallWithOptparse argv = case commandParseArgs globalCmd True argv of CommandReadyToGo (mkGlobalFlags, cmdArgs0) -> case cmdArgs0 of @@ -393,6 +393,9 @@ mainWorker args = do | CmdBuild.isBuildCommandName cmdName -> let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) in Just $ CommandReadyToGo (globalFlags, CmdBuild.parseBuildCommand cmdName cmdArgs) + | CmdInstall.isInstallCommandName cmdName -> + let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) + in Just $ CommandReadyToGo (globalFlags, CmdInstall.parseInstallCommand cmdName cmdArgs) _ -> Nothing _ -> Nothing @@ -505,7 +508,7 @@ mainWorker args = do , newCmd CmdHaddockProject.haddockProjectCommand CmdHaddockProject.haddockProjectAction - , newCmd CmdInstall.installCommand CmdInstall.installAction + , CmdInstall.cmdSpec , newCmd CmdRun.runCommand CmdRun.runAction , newCmd CmdTest.testCommand CmdTest.testAction , newCmd CmdBench.benchCommand CmdBench.benchAction From 4a2570691ddc1c756b61c41c9889fd0b8afbf712 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 6 Aug 2026 07:58:10 -0400 Subject: [PATCH 041/104] Add OptionGroupKey --- .../Distribution/Client/CommandUIOptParse.hs | 82 ++++++++++++++----- 1 file changed, 61 insertions(+), 21 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs index 25f21d5b936..de0e3922f8a 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -266,26 +266,66 @@ groupSequentially options groupingSpecs = (leftoverOptions, groupedBuckets) = mapAccumL step options groupingSpecs in (groupedBuckets, leftoverOptions) -groupPredicates :: [(String, OptionField a -> Bool)] +data OptionGroupKey + = UnsupportedOptions + | InstallLayoutOptions + | IrrelevantOptions + | HaddockOptions + | TestOptions + | BenchmarkOptions + | ProfilingOptions + | DependencySolvingOptions + | ExecutableBuildOptions + | LibraryBuildOptions + | CoverageOptions + | OutputAndArtifactOptions + | ConfigurePhaseOptions + | BuildPhaseControlOptions + | CompilerAndParallelismOptions + | LoggingAndReportingOptions + | IncludeAndLinkerPathOptions + | ProgramOverrideOptions + +instance Show OptionGroupKey where + show UnsupportedOptions = "Unsupported options" + show InstallLayoutOptions = "Install layout options" + show IrrelevantOptions = "Irrelevant options" + show HaddockOptions = "Haddock options" + show TestOptions = "Test options" + show BenchmarkOptions = "Benchmark options" + show ProfilingOptions = "Profiling options" + show DependencySolvingOptions = "Dependency solving options" + show ExecutableBuildOptions = "Executable build options" + show LibraryBuildOptions = "Library build options" + show CoverageOptions = "Coverage options" + show OutputAndArtifactOptions = "Output and artifact options" + show ConfigurePhaseOptions = "Configure-phase options" + show BuildPhaseControlOptions = "Build phase control options" + show CompilerAndParallelismOptions = "Compiler and parallelism options" + show LoggingAndReportingOptions = "Logging and reporting options" + show IncludeAndLinkerPathOptions = "Include and linker path options" + show ProgramOverrideOptions = "Program override options" + +groupPredicates :: [(OptionGroupKey, OptionField a -> Bool)] groupPredicates = - [ ("Unsupported options", keepUnsupportedOptions) - , ("Install layout options", keepInstallOptions) - , ("Irrelevant options", keepIrrelevantOptions) - , ("Haddock options", keepHaddockOptions) - , ("Test options", keepTestOptions) - , ("Benchmark options", keepBenchOptions) - , ("Profiling options", keepProfilingOptions) - , ("Dependency solving options", keepSolvingOptions) - , ("Executable build options", keepExeOptions) - , ("Library build options", keepLibOptions) - , ("Coverage options", keepCoverageOptions) - , ("Output and artifact options", keepOutputOptions) - , ("Configure-phase options", keepConfigureOptions) - , ("Build phase control options", keepPhaseOptions) - , ("Compiler and parallelism options", keepCompilerOptions) - , ("Logging and reporting options", keepLoggingOptions) - , ("Include and linker path options", keepIncludeOptions) - , ("Program override options", keepProgOptions) + [ (UnsupportedOptions, keepUnsupportedOptions) + , (InstallLayoutOptions, keepInstallOptions) + , (IrrelevantOptions, keepIrrelevantOptions) + , (HaddockOptions, keepHaddockOptions) + , (TestOptions, keepTestOptions) + , (BenchmarkOptions, keepBenchOptions) + , (ProfilingOptions, keepProfilingOptions) + , (DependencySolvingOptions, keepSolvingOptions) + , (ExecutableBuildOptions, keepExeOptions) + , (LibraryBuildOptions, keepLibOptions) + , (CoverageOptions, keepCoverageOptions) + , (OutputAndArtifactOptions, keepOutputOptions) + , (ConfigurePhaseOptions, keepConfigureOptions) + , (BuildPhaseControlOptions, keepPhaseOptions) + , (CompilerAndParallelismOptions, keepCompilerOptions) + , (LoggingAndReportingOptions, keepLoggingOptions) + , (IncludeAndLinkerPathOptions, keepIncludeOptions) + , (ProgramOverrideOptions, keepProgOptions) ] type ReplaceCommandAlias = String -> String -> String @@ -356,7 +396,7 @@ helpText replaceBuildAlias buildCommand invokedName pname = <> "\n" <> concat [" - " <> warning <> "\n" | warning <- warnings] - renderGroup :: (String, [OptionField a]) -> (String, [String]) + renderGroup :: (OptionGroupKey, [OptionField a]) -> (String, [String]) renderGroup (title, options) | null options = ("", []) | otherwise = @@ -368,7 +408,7 @@ helpText replaceBuildAlias buildCommand invokedName pname = helpOutputWidth (concatMap optionFieldToGetOpt options) in ( "\n" - <> colorizeHeader (title <> ":") + <> colorizeHeader (show title <> ":") <> "\n" <> rows , warnings From f8e25ff5766e7c06dcc3e4b96c97ab9284c07400 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 6 Aug 2026 08:27:28 -0400 Subject: [PATCH 042/104] Lambda lift renderGroup --- .../Distribution/Client/CommandUIOptParse.hs | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs index de0e3922f8a..6021eb41205 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -27,21 +27,15 @@ module Distribution.Client.CommandUIOptParse import Distribution.Client.Compat.Prelude import Prelude () -import qualified Data.Text as T import Data.Char (isLower) import Data.List (mapAccumL, stripPrefix) import Data.Monoid (Endo (..)) +import qualified Data.Text as T import qualified System.Console.GetOpt as GetOpt -import Distribution.ReadE (runReadE) -import Distribution.Simple.Command - ( OptDescr (..) - , OptionField (..) - , ShowOrParseArgs (ShowArgs) - , CommandUI (..) - ) import Distribution.Client.NixStyleOptions - ( keepBenchOptions + ( NixStyleFlags (..) + , keepBenchOptions , keepCompilerOptions , keepConfigureOptions , keepCoverageOptions @@ -59,7 +53,13 @@ import Distribution.Client.NixStyleOptions , keepSolvingOptions , keepTestOptions , keepUnsupportedOptions - , NixStyleFlags(..) + ) +import Distribution.ReadE (runReadE) +import Distribution.Simple.Command + ( CommandUI (..) + , OptDescr (..) + , OptionField (..) + , ShowOrParseArgs (ShowArgs) ) import qualified Options.Applicative as O @@ -381,7 +381,8 @@ helpText replaceBuildAlias buildCommand invokedName pname = helpOutputWidth (commonHelpOptions ++ concatMap optionFieldToGetOpt optsUngrouped) - renderedGroups = map renderGroup optsGrouped + renderGroupToWidth = renderGroup maxFlagColumnWidth descColumn helpOutputWidth + renderedGroups = map renderGroupToWidth optsGrouped groupedRows = concatMap fst renderedGroups @@ -396,27 +397,27 @@ helpText replaceBuildAlias buildCommand invokedName pname = <> "\n" <> concat [" - " <> warning <> "\n" | warning <- warnings] - renderGroup :: (OptionGroupKey, [OptionField a]) -> (String, [String]) - renderGroup (title, options) - | null options = ("", []) - | otherwise = - let (rows, warnings) = - renderOptionRows - colorizeWarningHeader - maxFlagColumnWidth - descColumn - helpOutputWidth - (concatMap optionFieldToGetOpt options) - in ( "\n" - <> colorizeHeader (show title <> ":") - <> "\n" - <> rows - , warnings - ) - (optsGrouped, optsUngrouped) = groupSequentially (commandOptions buildCommand ShowArgs) groupPredicates +renderGroup :: Int -> Int -> Int -> (OptionGroupKey, [OptionField a]) -> (String, [String]) +renderGroup maxFlagColumnWidth descColumn helpOutputWidth (title, options) + | null options = ("", []) + | otherwise = + let (rows, warnings) = + renderOptionRows + colorizeWarningHeader + maxFlagColumnWidth + descColumn + helpOutputWidth + (concatMap optionFieldToGetOpt options) + in ( "\n" + <> colorizeHeader (show title <> ":") + <> "\n" + <> rows + , warnings + ) + colorizeHeader :: String -> String colorizeHeader text = "\ESC[32m" <> text <> "\ESC[0m" From 29ed6939026a5ea52da8aa2946a87b5d9a554d28 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 6 Aug 2026 08:36:04 -0400 Subject: [PATCH 043/104] Render the install layout group compactly --- .../Distribution/Client/CommandUIOptParse.hs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs index 6021eb41205..082910ff114 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/CommandUIOptParse.hs @@ -61,6 +61,7 @@ import Distribution.Simple.Command , OptionField (..) , ShowOrParseArgs (ShowArgs) ) +import Distribution.Simple.Utils (ordNub) import qualified Options.Applicative as O @@ -285,6 +286,7 @@ data OptionGroupKey | LoggingAndReportingOptions | IncludeAndLinkerPathOptions | ProgramOverrideOptions + deriving (Eq) instance Show OptionGroupKey where show UnsupportedOptions = "Unsupported options" @@ -403,6 +405,7 @@ helpText replaceBuildAlias buildCommand invokedName pname = renderGroup :: Int -> Int -> Int -> (OptionGroupKey, [OptionField a]) -> (String, [String]) renderGroup maxFlagColumnWidth descColumn helpOutputWidth (title, options) | null options = ("", []) + | title == InstallLayoutOptions = renderInstallLayoutGroupCompact helpOutputWidth options | otherwise = let (rows, warnings) = renderOptionRows @@ -418,6 +421,20 @@ renderGroup maxFlagColumnWidth descColumn helpOutputWidth (title, options) , warnings ) +renderInstallLayoutGroupCompact :: Int -> [OptionField a] -> (String, [String]) +renderInstallLayoutGroupCompact helpOutputWidth options = + ( "\n" + <> colorizeHeader (show InstallLayoutOptions <> ":") + <> "\n" + <> concat [" " <> line <> "\n" | line <- wrappedFlagLines] + , [] + ) + where + flagColumns = map (fst . getOptToColumns) (concatMap optionFieldToGetOpt options) + compactFlags = ordNub flagColumns + flagsLine = intercalate ", " compactFlags + wrappedFlagLines = wrapDescription (max 40 (helpOutputWidth - 2)) flagsLine + colorizeHeader :: String -> String colorizeHeader text = "\ESC[32m" <> text <> "\ESC[0m" From 4c14be93a34286c12d7e18d493549fb413a1f904 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 6 Aug 2026 12:00:13 -0400 Subject: [PATCH 044/104] Move module to Client.Cmd.UI --- cabal-install/cabal-install.cabal | 2 +- .../Distribution/Client/{CommandUIOptParse.hs => Cmd/UI.hs} | 2 +- cabal-install/src/Distribution/Client/CmdBuild.hs | 6 +++--- cabal-install/src/Distribution/Client/CmdInstall.hs | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) rename cabal-install/src/Distribution/Client/{CommandUIOptParse.hs => Cmd/UI.hs} (99%) diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index 26d6252c932..5c9b2396c40 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -106,7 +106,7 @@ library Distribution.Client.CmdClean Distribution.Client.CmdConfigure Distribution.Client.CmdErrorMessages - Distribution.Client.CommandUIOptParse + Distribution.Client.Cmd.UI Distribution.Client.CmdExec Distribution.Client.CmdFreeze Distribution.Client.CmdHaddock diff --git a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs similarity index 99% rename from cabal-install/src/Distribution/Client/CommandUIOptParse.hs rename to cabal-install/src/Distribution/Client/Cmd/UI.hs index 082910ff114..dcf4aac3e4c 100644 --- a/cabal-install/src/Distribution/Client/CommandUIOptParse.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -1,6 +1,6 @@ {-# LANGUAGE LambdaCase #-} -module Distribution.Client.CommandUIOptParse +module Distribution.Client.Cmd.UI ( -- * Converting CommandUI options to optparse-applicative parsers optionFieldFlagParsers , optionFieldParser diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 2e295c1650c..acb4b6d373b 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -32,7 +32,7 @@ import Distribution.Client.TargetProblem import qualified Data.Map as Map import Data.Monoid (Endo (..), appEndo) import qualified Data.Text as T -import qualified Distribution.Client.CommandUIOptParse as CommandUIOpt +import Distribution.Client.Cmd.UI (optionFieldFlagParsers, helpText) import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -304,7 +304,7 @@ parseBuildCommand invokedName cmdArgs = Failure failure -> let (msg, exitCode) = renderFailure failure ("cabal " ++ invokedName) in if exitCode == ExitSuccess - then CommandHelp (CommandUIOpt.helpText replaceBuildAlias buildCommand invokedName) + then CommandHelp (helpText replaceBuildAlias buildCommand invokedName) else CommandErrors [msg] CompletionInvoked _ -> CommandErrors ["Shell completion is not supported by this parser path."] @@ -368,4 +368,4 @@ buildOptionParsers :: [Parser BuildItem] buildOptionParsers = (fmap . fmap) BuildItemFlag - (CommandUIOpt.optionFieldFlagParsers $ commandOptions buildCommand ParseArgs) + (optionFieldFlagParsers $ commandOptions buildCommand ParseArgs) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 1e37dda63c6..6a47d50b508 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -120,7 +120,7 @@ import Distribution.Package import Distribution.Simple.BuildPaths ( exeExtension ) -import qualified Distribution.Client.CommandUIOptParse as CommandUIOpt +import Distribution.Client.Cmd.UI (optionFieldFlagParsers, helpText) import Distribution.Simple.Command ( CommandParse (..) , CommandSpec (..) @@ -1469,7 +1469,7 @@ parseInstallCommand invokedName cmdArgs = Failure failure -> let (msg, exitCode) = renderFailure failure ("cabal " ++ invokedName) in if exitCode == ExitSuccess - then CommandHelp (CommandUIOpt.helpText replaceInstallAlias installCommand invokedName) + then CommandHelp (helpText replaceInstallAlias installCommand invokedName) else CommandErrors [msg] CompletionInvoked _ -> CommandErrors ["Shell completion is not supported by this parser path."] @@ -1545,4 +1545,4 @@ installOptionParsers :: [Parser InstallItem] installOptionParsers = (fmap . fmap) InstallItemFlag - (CommandUIOpt.optionFieldFlagParsers $ commandOptions installCommand ParseArgs) + (optionFieldFlagParsers $ commandOptions installCommand ParseArgs) From 75957c26b3136f9aacfd6a75a6fd6a0b35068997 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 6 Aug 2026 15:26:01 -0400 Subject: [PATCH 045/104] For test-show-details, list options --- Cabal/src/Distribution/Simple/Setup/Test.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Setup/Test.hs b/Cabal/src/Distribution/Simple/Setup/Test.hs index 5a1563f2b70..718cde13305 100644 --- a/Cabal/src/Distribution/Simple/Setup/Test.hs +++ b/Cabal/src/Distribution/Simple/Setup/Test.hs @@ -194,11 +194,14 @@ testOptions' showOrParseArgs = , option [] ["show-details"] - ( "'always': always show results of individual test cases. " - ++ "'never': never show results of individual test cases. " - ++ "'failures': show results of failing test cases. " - ++ "'streaming': show results of test cases in real time." - ++ "'direct': send results of test cases in real time; no log file." + ( unlines + [ "Allowed values:" + , "- always: always show results of individual test cases," + , "- never: never show results of individual test cases," + , "- failures: show results of failing test cases," + , "- streaming: show results of test cases in real time," + , "- direct: send results of test cases in real time; no log file." + ] ) testShowDetails (\v flags -> flags{testShowDetails = v}) From 236c0e0c18974f1eb7fb5b91266dd2d129df6d29 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Fri, 7 Aug 2026 08:34:57 -0400 Subject: [PATCH 046/104] Add a deprecated group --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 8 ++++++-- cabal-install/src/Distribution/Client/NixStyleOptions.hs | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index dcf4aac3e4c..10fee70dac4 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -53,6 +53,7 @@ import Distribution.Client.NixStyleOptions , keepSolvingOptions , keepTestOptions , keepUnsupportedOptions + , keepDeprecatedOptions ) import Distribution.ReadE (runReadE) import Distribution.Simple.Command @@ -268,7 +269,8 @@ groupSequentially options groupingSpecs = in (groupedBuckets, leftoverOptions) data OptionGroupKey - = UnsupportedOptions + = DeprecatedOptions + | UnsupportedOptions | InstallLayoutOptions | IrrelevantOptions | HaddockOptions @@ -289,6 +291,7 @@ data OptionGroupKey deriving (Eq) instance Show OptionGroupKey where + show DeprecatedOptions = "Deprecated options" show UnsupportedOptions = "Unsupported options" show InstallLayoutOptions = "Install layout options" show IrrelevantOptions = "Irrelevant options" @@ -310,7 +313,8 @@ instance Show OptionGroupKey where groupPredicates :: [(OptionGroupKey, OptionField a -> Bool)] groupPredicates = - [ (UnsupportedOptions, keepUnsupportedOptions) + [ (DeprecatedOptions, keepDeprecatedOptions) + , (UnsupportedOptions, keepUnsupportedOptions) , (InstallLayoutOptions, keepInstallOptions) , (IrrelevantOptions, keepIrrelevantOptions) , (HaddockOptions, keepHaddockOptions) diff --git a/cabal-install/src/Distribution/Client/NixStyleOptions.hs b/cabal-install/src/Distribution/Client/NixStyleOptions.hs index 63ea3d6ded0..c6eda25bda8 100644 --- a/cabal-install/src/Distribution/Client/NixStyleOptions.hs +++ b/cabal-install/src/Distribution/Client/NixStyleOptions.hs @@ -12,6 +12,7 @@ module Distribution.Client.NixStyleOptions , cfgVerbosity -- * Option filtering/grouping predicates + , keepDeprecatedOptions , keepUnsupportedOptions , keepInstallOptions , keepIrrelevantOptions @@ -186,6 +187,9 @@ cfgVerbosity v flags = mkVerbosity defaultVerbosityHandles $ fromFlagOrDefault v (setupVerbosity . configCommonFlags $ configFlags flags) +keepDeprecatedOptions :: OptionField a -> Bool +keepDeprecatedOptions (optionName -> o) = "prefer-oldest" == o + keepUnsupportedOptions :: OptionField a -> Bool keepUnsupportedOptions (optionName -> o) = "root-cmd" == o || "allow-boot-library-installs" == o From 7d1f8cf056e07d0daa77ac2c9b7e1a287bb93320 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Mon, 10 Aug 2026 13:27:29 -0400 Subject: [PATCH 047/104] Generalise CmdItem --- .../src/Distribution/Client/Cmd/UI.hs | 10 +++++++- .../src/Distribution/Client/CmdBuild.hs | 23 ++++++++--------- .../src/Distribution/Client/CmdInstall.hs | 25 ++++++++----------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 10fee70dac4..7988fed7e66 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -12,6 +12,9 @@ module Distribution.Client.Cmd.UI , optionFieldToGetOpt , optDescrToGetOpt + -- * Command data types + , CmdItem (..) + -- * Help text layout helpers , renderOptionRows , getOptToColumns @@ -39,6 +42,7 @@ import Distribution.Client.NixStyleOptions , keepCompilerOptions , keepConfigureOptions , keepCoverageOptions + , keepDeprecatedOptions , keepExeOptions , keepHaddockOptions , keepIncludeOptions @@ -53,7 +57,6 @@ import Distribution.Client.NixStyleOptions , keepSolvingOptions , keepTestOptions , keepUnsupportedOptions - , keepDeprecatedOptions ) import Distribution.ReadE (runReadE) import Distribution.Simple.Command @@ -66,6 +69,11 @@ import Distribution.Simple.Utils (ordNub) import qualified Options.Applicative as O +data CmdItem a + = CmdItemFlag (Endo (NixStyleFlags a)) + | CmdItemTarget String + | CmdItemListOptions + optionFieldFlagParsers :: [OptionField flags] -> [O.Parser (Endo flags)] optionFieldFlagParsers = concatMap optionFieldParser diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index acb4b6d373b..d4599afb1ca 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -32,7 +32,7 @@ import Distribution.Client.TargetProblem import qualified Data.Map as Map import Data.Monoid (Endo (..), appEndo) import qualified Data.Text as T -import Distribution.Client.Cmd.UI (optionFieldFlagParsers, helpText) +import Distribution.Client.Cmd.UI (CmdItem (..), helpText, optionFieldFlagParsers) import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -331,17 +331,14 @@ data ParsedBuildCommand = ParsedBuildCommand , parsedListOptions :: Bool } -data BuildItem - = BuildItemFlag (Endo (NixStyleFlags BuildFlags)) - | BuildItemTarget String - | BuildItemListOptions +type BuildCmdItem = CmdItem BuildFlags parsedBuildCommandParser :: Parser ParsedBuildCommand parsedBuildCommandParser = toParsed <$> many buildItemParser where toParsed items = - let edits = [e | BuildItemFlag e <- items] - targets = [t | BuildItemTarget t <- items] + let edits = [e | CmdItemFlag e <- items] + targets = [t | CmdItemTarget t <- items] listOptionsSeen = any isListOptions items in ParsedBuildCommand { parsedFlagEdits = mconcat edits @@ -349,23 +346,23 @@ parsedBuildCommandParser = toParsed <$> many buildItemParser , parsedListOptions = listOptionsSeen } - isListOptions BuildItemListOptions = True + isListOptions CmdItemListOptions = True isListOptions _ = False -buildItemParser :: Parser BuildItem +buildItemParser :: Parser BuildCmdItem buildItemParser = asum ( buildOptionParsers - ++ [ BuildItemListOptions + ++ [ CmdItemListOptions <$ flag' () (long "list-options" <> help "Print a list of command line flags") - , BuildItemTarget <$> strArgument (metavar "TARGET") + , CmdItemTarget <$> strArgument (metavar "TARGET") ] ) -buildOptionParsers :: [Parser BuildItem] +buildOptionParsers :: [Parser BuildCmdItem] buildOptionParsers = (fmap . fmap) - BuildItemFlag + CmdItemFlag (optionFieldFlagParsers $ commandOptions buildCommand ParseArgs) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 6a47d50b508..953a6c23616 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -34,6 +34,7 @@ import Distribution.Client.TargetProblem import Distribution.Client.CmdInstall.ClientInstallFlags import Distribution.Client.CmdInstall.ClientInstallTargetSelector +import Distribution.Client.Cmd.UI (CmdItem (..), helpText, optionFieldFlagParsers) import Distribution.Client.Config ( SavedConfig (..) , defaultInstallPath @@ -120,7 +121,6 @@ import Distribution.Package import Distribution.Simple.BuildPaths ( exeExtension ) -import Distribution.Client.Cmd.UI (optionFieldFlagParsers, helpText) import Distribution.Simple.Command ( CommandParse (..) , CommandSpec (..) @@ -230,11 +230,11 @@ import qualified Data.ByteString.Lazy.Char8 as BS import qualified Data.List.NonEmpty as NE import qualified Data.Map as Map import Data.Monoid (Endo (..), appEndo) -import qualified Data.Text as T import Data.Ord ( Down (..) ) import qualified Data.Set as S +import qualified Data.Text as T import Distribution.Client.Errors import Distribution.Utils.NubList ( fromNubList @@ -1508,17 +1508,14 @@ data ParsedInstallCommand = ParsedInstallCommand , parsedListOptions :: Bool } -data InstallItem - = InstallItemFlag (Endo (NixStyleFlags ClientInstallFlags)) - | InstallItemTarget String - | InstallItemListOptions +type InstallCmdItem = CmdItem ClientInstallFlags parsedInstallCommandParser :: Parser ParsedInstallCommand parsedInstallCommandParser = toParsed <$> many installItemParser where toParsed items = - let edits = [e | InstallItemFlag e <- items] - targets = [t | InstallItemTarget t <- items] + let edits = [e | CmdItemFlag e <- items] + targets = [t | CmdItemTarget t <- items] listOptionsSeen = any isListOptions items in ParsedInstallCommand { parsedFlagEdits = mconcat edits @@ -1526,23 +1523,23 @@ parsedInstallCommandParser = toParsed <$> many installItemParser , parsedListOptions = listOptionsSeen } - isListOptions InstallItemListOptions = True + isListOptions CmdItemListOptions = True isListOptions _ = False -installItemParser :: Parser InstallItem +installItemParser :: Parser InstallCmdItem installItemParser = asum ( installOptionParsers - ++ [ InstallItemListOptions + ++ [ CmdItemListOptions <$ flag' () (long "list-options" <> help "Print a list of command line flags") - , InstallItemTarget <$> strArgument (metavar "TARGET") + , CmdItemTarget <$> strArgument (metavar "TARGET") ] ) -installOptionParsers :: [Parser InstallItem] +installOptionParsers :: [Parser InstallCmdItem] installOptionParsers = (fmap . fmap) - InstallItemFlag + CmdItemFlag (optionFieldFlagParsers $ commandOptions installCommand ParseArgs) From d11c46a2b4a5d382ee1ffd7aeb1ca83a417e8ebd Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 11 Aug 2026 14:58:53 -0400 Subject: [PATCH 048/104] Generalise *OptionParsers --- cabal-install/src/Distribution/Client/CmdBuild.hs | 11 +++++------ cabal-install/src/Distribution/Client/CmdInstall.hs | 10 ++++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index d4599afb1ca..3a7622c4abd 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -52,6 +52,7 @@ import Distribution.Simple.Command , CommandSpec (..) , CommandType (..) , CommandUI (..) + , OptionField (..) , ShowOrParseArgs (ParseArgs) , commandAddAction , commandParseArgs @@ -352,7 +353,7 @@ parsedBuildCommandParser = toParsed <$> many buildItemParser buildItemParser :: Parser BuildCmdItem buildItemParser = asum - ( buildOptionParsers + ( buildOptionParsers (commandOptions buildCommand ParseArgs) ++ [ CmdItemListOptions <$ flag' () @@ -361,8 +362,6 @@ buildItemParser = ] ) -buildOptionParsers :: [Parser BuildCmdItem] -buildOptionParsers = - (fmap . fmap) - CmdItemFlag - (optionFieldFlagParsers $ commandOptions buildCommand ParseArgs) +buildOptionParsers + :: [OptionField (NixStyleFlags a)] -> [Parser (CmdItem a)] +buildOptionParsers fields = (fmap . fmap) CmdItemFlag (optionFieldFlagParsers fields) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 953a6c23616..da8fa688fa4 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -126,6 +126,7 @@ import Distribution.Simple.Command , CommandSpec (..) , CommandType (..) , CommandUI (..) + , OptionField (..) , ShowOrParseArgs (ParseArgs) , commandAddAction , commandParseArgs @@ -1529,7 +1530,7 @@ parsedInstallCommandParser = toParsed <$> many installItemParser installItemParser :: Parser InstallCmdItem installItemParser = asum - ( installOptionParsers + ( installOptionParsers (commandOptions installCommand ParseArgs) ++ [ CmdItemListOptions <$ flag' () @@ -1538,8 +1539,5 @@ installItemParser = ] ) -installOptionParsers :: [Parser InstallCmdItem] -installOptionParsers = - (fmap . fmap) - CmdItemFlag - (optionFieldFlagParsers $ commandOptions installCommand ParseArgs) +installOptionParsers :: [OptionField (NixStyleFlags a)] -> [Parser (CmdItem a)] +installOptionParsers fields = (fmap . fmap) CmdItemFlag (optionFieldFlagParsers fields) From 56d144e8768d0efc38c9f55d90410841e02e911c Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 11 Aug 2026 15:04:21 -0400 Subject: [PATCH 049/104] Move cmdOptionParsers --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 4 ++++ cabal-install/src/Distribution/Client/CmdBuild.hs | 9 ++------- cabal-install/src/Distribution/Client/CmdInstall.hs | 7 ++----- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 7988fed7e66..f7602b55e21 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -14,6 +14,7 @@ module Distribution.Client.Cmd.UI -- * Command data types , CmdItem (..) + , cmdOptionParsers -- * Help text layout helpers , renderOptionRows @@ -74,6 +75,9 @@ data CmdItem a | CmdItemTarget String | CmdItemListOptions +cmdOptionParsers :: [OptionField (NixStyleFlags a)] -> [O.Parser (CmdItem a)] +cmdOptionParsers fields = (fmap . fmap) CmdItemFlag (optionFieldFlagParsers fields) + optionFieldFlagParsers :: [OptionField flags] -> [O.Parser (Endo flags)] optionFieldFlagParsers = concatMap optionFieldParser diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 3a7622c4abd..c984a4b7f78 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -32,7 +32,7 @@ import Distribution.Client.TargetProblem import qualified Data.Map as Map import Data.Monoid (Endo (..), appEndo) import qualified Data.Text as T -import Distribution.Client.Cmd.UI (CmdItem (..), helpText, optionFieldFlagParsers) +import Distribution.Client.Cmd.UI (CmdItem (..), cmdOptionParsers, helpText) import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -52,7 +52,6 @@ import Distribution.Simple.Command , CommandSpec (..) , CommandType (..) , CommandUI (..) - , OptionField (..) , ShowOrParseArgs (ParseArgs) , commandAddAction , commandParseArgs @@ -353,7 +352,7 @@ parsedBuildCommandParser = toParsed <$> many buildItemParser buildItemParser :: Parser BuildCmdItem buildItemParser = asum - ( buildOptionParsers (commandOptions buildCommand ParseArgs) + ( cmdOptionParsers (commandOptions buildCommand ParseArgs) ++ [ CmdItemListOptions <$ flag' () @@ -361,7 +360,3 @@ buildItemParser = , CmdItemTarget <$> strArgument (metavar "TARGET") ] ) - -buildOptionParsers - :: [OptionField (NixStyleFlags a)] -> [Parser (CmdItem a)] -buildOptionParsers fields = (fmap . fmap) CmdItemFlag (optionFieldFlagParsers fields) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index da8fa688fa4..ff1db516ca1 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -34,7 +34,7 @@ import Distribution.Client.TargetProblem import Distribution.Client.CmdInstall.ClientInstallFlags import Distribution.Client.CmdInstall.ClientInstallTargetSelector -import Distribution.Client.Cmd.UI (CmdItem (..), helpText, optionFieldFlagParsers) +import Distribution.Client.Cmd.UI (CmdItem (..), cmdOptionParsers, helpText) import Distribution.Client.Config ( SavedConfig (..) , defaultInstallPath @@ -1530,7 +1530,7 @@ parsedInstallCommandParser = toParsed <$> many installItemParser installItemParser :: Parser InstallCmdItem installItemParser = asum - ( installOptionParsers (commandOptions installCommand ParseArgs) + ( cmdOptionParsers (commandOptions installCommand ParseArgs) ++ [ CmdItemListOptions <$ flag' () @@ -1538,6 +1538,3 @@ installItemParser = , CmdItemTarget <$> strArgument (metavar "TARGET") ] ) - -installOptionParsers :: [OptionField (NixStyleFlags a)] -> [Parser (CmdItem a)] -installOptionParsers fields = (fmap . fmap) CmdItemFlag (optionFieldFlagParsers fields) From 19f12faf724e89a5fefbdee4eb9e58e5f4744445 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 11 Aug 2026 15:22:13 -0400 Subject: [PATCH 050/104] Move cmdItemParser --- .../src/Distribution/Client/Cmd/UI.hs | 21 +++++++++++++++ .../src/Distribution/Client/CmdBuild.hs | 26 +++---------------- .../src/Distribution/Client/CmdInstall.hs | 26 +++---------------- 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index f7602b55e21..a6fdf663544 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -14,6 +14,7 @@ module Distribution.Client.Cmd.UI -- * Command data types , CmdItem (..) + , cmdItemParser , cmdOptionParsers -- * Help text layout helpers @@ -68,6 +69,14 @@ import Distribution.Simple.Command ) import Distribution.Simple.Utils (ordNub) +import Options.Applicative + ( asum + , flag' + , help + , long + , metavar + , strArgument + ) import qualified Options.Applicative as O data CmdItem a @@ -75,6 +84,18 @@ data CmdItem a | CmdItemTarget String | CmdItemListOptions +cmdItemParser :: [O.Parser (CmdItem a)] -> O.Parser (CmdItem a) +cmdItemParser flags = + asum + ( flags + ++ [ CmdItemListOptions + <$ flag' + () + (long "list-options" <> help "Print a list of command line flags") + , CmdItemTarget <$> strArgument (metavar "TARGET") + ] + ) + cmdOptionParsers :: [OptionField (NixStyleFlags a)] -> [O.Parser (CmdItem a)] cmdOptionParsers fields = (fmap . fmap) CmdItemFlag (optionFieldFlagParsers fields) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index c984a4b7f78..715e4f0dd56 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -32,7 +32,7 @@ import Distribution.Client.TargetProblem import qualified Data.Map as Map import Data.Monoid (Endo (..), appEndo) import qualified Data.Text as T -import Distribution.Client.Cmd.UI (CmdItem (..), cmdOptionParsers, helpText) +import Distribution.Client.Cmd.UI (CmdItem (..), cmdItemParser, cmdOptionParsers, helpText) import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -65,21 +65,15 @@ import Options.Applicative ( Parser , ParserInfo , ParserResult (..) - , asum , defaultPrefs , execParserPure - , flag' , footer , fullDesc , header - , help , helper , info - , long - , metavar , progDesc , renderFailure - , strArgument , (<**>) ) @@ -331,11 +325,11 @@ data ParsedBuildCommand = ParsedBuildCommand , parsedListOptions :: Bool } -type BuildCmdItem = CmdItem BuildFlags - parsedBuildCommandParser :: Parser ParsedBuildCommand -parsedBuildCommandParser = toParsed <$> many buildItemParser +parsedBuildCommandParser = toParsed <$> many (cmdItemParser flagParsers) where + flagParsers = cmdOptionParsers (commandOptions buildCommand ParseArgs) + toParsed items = let edits = [e | CmdItemFlag e <- items] targets = [t | CmdItemTarget t <- items] @@ -348,15 +342,3 @@ parsedBuildCommandParser = toParsed <$> many buildItemParser isListOptions CmdItemListOptions = True isListOptions _ = False - -buildItemParser :: Parser BuildCmdItem -buildItemParser = - asum - ( cmdOptionParsers (commandOptions buildCommand ParseArgs) - ++ [ CmdItemListOptions - <$ flag' - () - (long "list-options" <> help "Print a list of command line flags") - , CmdItemTarget <$> strArgument (metavar "TARGET") - ] - ) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index ff1db516ca1..ef3b152a8bd 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -34,7 +34,7 @@ import Distribution.Client.TargetProblem import Distribution.Client.CmdInstall.ClientInstallFlags import Distribution.Client.CmdInstall.ClientInstallTargetSelector -import Distribution.Client.Cmd.UI (CmdItem (..), cmdOptionParsers, helpText) +import Distribution.Client.Cmd.UI (CmdItem (..), cmdItemParser, cmdOptionParsers, helpText) import Distribution.Client.Config ( SavedConfig (..) , defaultInstallPath @@ -245,21 +245,15 @@ import Options.Applicative ( Parser , ParserInfo , ParserResult (..) - , asum , defaultPrefs , execParserPure - , flag' , footer , fullDesc , header - , help , helper , info - , long - , metavar , progDesc , renderFailure - , strArgument , (<**>) ) import System.Directory @@ -1509,11 +1503,11 @@ data ParsedInstallCommand = ParsedInstallCommand , parsedListOptions :: Bool } -type InstallCmdItem = CmdItem ClientInstallFlags - parsedInstallCommandParser :: Parser ParsedInstallCommand -parsedInstallCommandParser = toParsed <$> many installItemParser +parsedInstallCommandParser = toParsed <$> many (cmdItemParser flagParsers) where + flagParsers = cmdOptionParsers (commandOptions installCommand ParseArgs) + toParsed items = let edits = [e | CmdItemFlag e <- items] targets = [t | CmdItemTarget t <- items] @@ -1526,15 +1520,3 @@ parsedInstallCommandParser = toParsed <$> many installItemParser isListOptions CmdItemListOptions = True isListOptions _ = False - -installItemParser :: Parser InstallCmdItem -installItemParser = - asum - ( cmdOptionParsers (commandOptions installCommand ParseArgs) - ++ [ CmdItemListOptions - <$ flag' - () - (long "list-options" <> help "Print a list of command line flags") - , CmdItemTarget <$> strArgument (metavar "TARGET") - ] - ) From 45985c4c68a7581e9c11f7342a6ba8a92d74cea6 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 11 Aug 2026 15:39:24 -0400 Subject: [PATCH 051/104] Move parsedCommandParser --- .../src/Distribution/Client/Cmd/UI.hs | 24 +++++++++++ .../src/Distribution/Client/CmdBuild.hs | 40 +++++-------------- .../src/Distribution/Client/CmdInstall.hs | 40 +++++-------------- 3 files changed, 46 insertions(+), 58 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index a6fdf663544..38d0188742b 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -14,6 +14,8 @@ module Distribution.Client.Cmd.UI -- * Command data types , CmdItem (..) + , ParsedCommand (..) + , parsedCommandParser , cmdItemParser , cmdOptionParsers @@ -84,6 +86,28 @@ data CmdItem a | CmdItemTarget String | CmdItemListOptions +data ParsedCommand a = ParsedCommand + { parsedFlagEdits :: Endo (NixStyleFlags a) + , parsedTargets :: [String] + , parsedListOptions :: Bool + } + +parsedCommandParser :: [O.Parser (CmdItem a)] -> O.Parser (ParsedCommand a) +parsedCommandParser flagParsers = toParsed <$> many (cmdItemParser flagParsers) + where + toParsed items = + let edits = [e | CmdItemFlag e <- items] + targets = [t | CmdItemTarget t <- items] + listOptionsSeen = any isListOptions items + in ParsedCommand + { parsedFlagEdits = mconcat edits + , parsedTargets = targets + , parsedListOptions = listOptionsSeen + } + + isListOptions CmdItemListOptions = True + isListOptions _ = False + cmdItemParser :: [O.Parser (CmdItem a)] -> O.Parser (CmdItem a) cmdItemParser flags = asum diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 715e4f0dd56..ecbb1c6c93e 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -32,7 +32,12 @@ import Distribution.Client.TargetProblem import qualified Data.Map as Map import Data.Monoid (Endo (..), appEndo) import qualified Data.Text as T -import Distribution.Client.Cmd.UI (CmdItem (..), cmdItemParser, cmdOptionParsers, helpText) +import Distribution.Client.Cmd.UI + ( ParsedCommand (..) + , cmdOptionParsers + , helpText + , parsedCommandParser + ) import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -62,8 +67,7 @@ import Distribution.Simple.Flag (Flag, fromFlag, toFlag) import Distribution.Simple.Utils (dieWithException, wrapText) import Distribution.Verbosity (normal) import Options.Applicative - ( Parser - , ParserInfo + ( ParserInfo , ParserResult (..) , defaultPrefs , execParserPure @@ -303,42 +307,20 @@ parseBuildCommand invokedName cmdArgs = CompletionInvoked _ -> CommandErrors ["Shell completion is not supported by this parser path."] -buildParserInfo :: String -> ParserInfo ParsedBuildCommand +buildParserInfo :: String -> ParserInfo (ParsedCommand BuildFlags) buildParserInfo invokedName = info - (parsedBuildCommandParser <**> helper) + (parsedCommandParser flagParsers <**> helper) ( fullDesc <> progDesc buildHelpDescription <> header ("cabal " ++ invokedName) <> footer (examples "cabal" invokedName) ) + where + flagParsers = cmdOptionParsers (commandOptions buildCommand ParseArgs) buildHelpDescription :: String buildHelpDescription = case commandDescription buildCommand of Nothing -> commandSynopsis buildCommand Just mkDescription -> mkDescription "cabal" - -data ParsedBuildCommand = ParsedBuildCommand - { parsedFlagEdits :: Endo (NixStyleFlags BuildFlags) - , parsedTargets :: [String] - , parsedListOptions :: Bool - } - -parsedBuildCommandParser :: Parser ParsedBuildCommand -parsedBuildCommandParser = toParsed <$> many (cmdItemParser flagParsers) - where - flagParsers = cmdOptionParsers (commandOptions buildCommand ParseArgs) - - toParsed items = - let edits = [e | CmdItemFlag e <- items] - targets = [t | CmdItemTarget t <- items] - listOptionsSeen = any isListOptions items - in ParsedBuildCommand - { parsedFlagEdits = mconcat edits - , parsedTargets = targets - , parsedListOptions = listOptionsSeen - } - - isListOptions CmdItemListOptions = True - isListOptions _ = False diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index ef3b152a8bd..6b3f52b3d59 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -34,7 +34,12 @@ import Distribution.Client.TargetProblem import Distribution.Client.CmdInstall.ClientInstallFlags import Distribution.Client.CmdInstall.ClientInstallTargetSelector -import Distribution.Client.Cmd.UI (CmdItem (..), cmdItemParser, cmdOptionParsers, helpText) +import Distribution.Client.Cmd.UI + ( ParsedCommand (..) + , cmdOptionParsers + , helpText + , parsedCommandParser + ) import Distribution.Client.Config ( SavedConfig (..) , defaultInstallPath @@ -242,8 +247,7 @@ import Distribution.Utils.NubList ) import Network.URI (URI) import Options.Applicative - ( Parser - , ParserInfo + ( ParserInfo , ParserResult (..) , defaultPrefs , execParserPure @@ -1469,15 +1473,17 @@ parseInstallCommand invokedName cmdArgs = CompletionInvoked _ -> CommandErrors ["Shell completion is not supported by this parser path."] -installParserInfo :: String -> ParserInfo ParsedInstallCommand +installParserInfo :: String -> ParserInfo (ParsedCommand ClientInstallFlags) installParserInfo invokedName = info - (parsedInstallCommandParser <**> helper) + (parsedCommandParser flagParsers <**> helper) ( fullDesc <> progDesc installHelpDescription <> header ("cabal " ++ invokedName) <> footer (installExamples invokedName) ) + where + flagParsers = cmdOptionParsers (commandOptions installCommand ParseArgs) installHelpDescription :: String installHelpDescription = @@ -1496,27 +1502,3 @@ installExamples invokedName = , " - cabal " <> invokedName <> " ./pkgfoo" , " Install the package in the ./pkgfoo directory" ] - -data ParsedInstallCommand = ParsedInstallCommand - { parsedFlagEdits :: Endo (NixStyleFlags ClientInstallFlags) - , parsedTargets :: [String] - , parsedListOptions :: Bool - } - -parsedInstallCommandParser :: Parser ParsedInstallCommand -parsedInstallCommandParser = toParsed <$> many (cmdItemParser flagParsers) - where - flagParsers = cmdOptionParsers (commandOptions installCommand ParseArgs) - - toParsed items = - let edits = [e | CmdItemFlag e <- items] - targets = [t | CmdItemTarget t <- items] - listOptionsSeen = any isListOptions items - in ParsedInstallCommand - { parsedFlagEdits = mconcat edits - , parsedTargets = targets - , parsedListOptions = listOptionsSeen - } - - isListOptions CmdItemListOptions = True - isListOptions _ = False From eb241169fc431233b611efeeec438fe953972554 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 11 Aug 2026 15:45:36 -0400 Subject: [PATCH 052/104] Move helpDescriptionOrSynopsis --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 7 +++++++ cabal-install/src/Distribution/Client/CmdBuild.hs | 9 ++------- cabal-install/src/Distribution/Client/CmdInstall.hs | 9 ++------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 38d0188742b..8acc5120157 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -18,6 +18,7 @@ module Distribution.Client.Cmd.UI , parsedCommandParser , cmdItemParser , cmdOptionParsers + , helpDescriptionOrSynopsis -- * Help text layout helpers , renderOptionRows @@ -81,6 +82,12 @@ import Options.Applicative ) import qualified Options.Applicative as O +helpDescriptionOrSynopsis :: CommandUI flags -> String +helpDescriptionOrSynopsis x = + case commandDescription x of + Nothing -> commandSynopsis x + Just mkDescription -> mkDescription "cabal" + data CmdItem a = CmdItemFlag (Endo (NixStyleFlags a)) | CmdItemTarget String diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index ecbb1c6c93e..4dcd4d36521 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -35,6 +35,7 @@ import qualified Data.Text as T import Distribution.Client.Cmd.UI ( ParsedCommand (..) , cmdOptionParsers + , helpDescriptionOrSynopsis , helpText , parsedCommandParser ) @@ -312,15 +313,9 @@ buildParserInfo invokedName = info (parsedCommandParser flagParsers <**> helper) ( fullDesc - <> progDesc buildHelpDescription + <> progDesc (helpDescriptionOrSynopsis buildCommand) <> header ("cabal " ++ invokedName) <> footer (examples "cabal" invokedName) ) where flagParsers = cmdOptionParsers (commandOptions buildCommand ParseArgs) - -buildHelpDescription :: String -buildHelpDescription = - case commandDescription buildCommand of - Nothing -> commandSynopsis buildCommand - Just mkDescription -> mkDescription "cabal" diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 6b3f52b3d59..be4ea11a798 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -37,6 +37,7 @@ import Distribution.Client.CmdInstall.ClientInstallTargetSelector import Distribution.Client.Cmd.UI ( ParsedCommand (..) , cmdOptionParsers + , helpDescriptionOrSynopsis , helpText , parsedCommandParser ) @@ -1478,19 +1479,13 @@ installParserInfo invokedName = info (parsedCommandParser flagParsers <**> helper) ( fullDesc - <> progDesc installHelpDescription + <> progDesc (helpDescriptionOrSynopsis installCommand) <> header ("cabal " ++ invokedName) <> footer (installExamples invokedName) ) where flagParsers = cmdOptionParsers (commandOptions installCommand ParseArgs) -installHelpDescription :: String -installHelpDescription = - case commandDescription installCommand of - Nothing -> commandSynopsis installCommand - Just mkDescription -> mkDescription "cabal" - installExamples :: String -> String installExamples invokedName = unlines From 18f8fde59a68ee4ca32fcb267e57a450e6b699ff Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 11 Aug 2026 16:06:01 -0400 Subject: [PATCH 053/104] Move parserInfo --- .../src/Distribution/Client/Cmd/UI.hs | 23 +++- .../src/Distribution/Client/CmdBuild.hs | 26 +---- .../src/Distribution/Client/CmdInstall.hs | 105 ++++++------------ 3 files changed, 62 insertions(+), 92 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 8acc5120157..049a8fbf220 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -19,6 +19,7 @@ module Distribution.Client.Cmd.UI , cmdItemParser , cmdOptionParsers , helpDescriptionOrSynopsis + , parserInfo -- * Help text layout helpers , renderOptionRows @@ -73,12 +74,20 @@ import Distribution.Simple.Command import Distribution.Simple.Utils (ordNub) import Options.Applicative - ( asum + ( ParserInfo + , asum , flag' + , footer + , fullDesc + , header , help + , helper + , info , long , metavar + , progDesc , strArgument + , (<**>) ) import qualified Options.Applicative as O @@ -99,6 +108,18 @@ data ParsedCommand a = ParsedCommand , parsedListOptions :: Bool } +type Examples = String -> String -> String + +parserInfo :: String -> Examples -> [O.Parser (CmdItem a)] -> CommandUI flags -> ParserInfo (ParsedCommand a) +parserInfo invokedName examples flagParsers cmdui = + info + (parsedCommandParser flagParsers <**> helper) + ( fullDesc + <> progDesc (helpDescriptionOrSynopsis cmdui) + <> header ("cabal " ++ invokedName) + <> footer (examples "cabal" invokedName) + ) + parsedCommandParser :: [O.Parser (CmdItem a)] -> O.Parser (ParsedCommand a) parsedCommandParser flagParsers = toParsed <$> many (cmdItemParser flagParsers) where diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 4dcd4d36521..69ba2ecc214 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -35,9 +35,8 @@ import qualified Data.Text as T import Distribution.Client.Cmd.UI ( ParsedCommand (..) , cmdOptionParsers - , helpDescriptionOrSynopsis , helpText - , parsedCommandParser + , parserInfo ) import Distribution.Client.Errors import Distribution.Client.NixStyleOptions @@ -68,18 +67,10 @@ import Distribution.Simple.Flag (Flag, fromFlag, toFlag) import Distribution.Simple.Utils (dieWithException, wrapText) import Distribution.Verbosity (normal) import Options.Applicative - ( ParserInfo - , ParserResult (..) + ( ParserResult (..) , defaultPrefs , execParserPure - , footer - , fullDesc - , header - , helper - , info - , progDesc , renderFailure - , (<**>) ) cmdSpec :: [CommandSpec (GlobalFlags -> IO ())] @@ -293,7 +284,7 @@ replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack parseBuildCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseBuildCommand invokedName cmdArgs = - case execParserPure defaultPrefs (buildParserInfo invokedName) cmdArgs of + case execParserPure defaultPrefs info cmdArgs of Success parsed -> if parsedListOptions parsed then CommandList buildListOptions @@ -307,15 +298,6 @@ parseBuildCommand invokedName cmdArgs = else CommandErrors [msg] CompletionInvoked _ -> CommandErrors ["Shell completion is not supported by this parser path."] - -buildParserInfo :: String -> ParserInfo (ParsedCommand BuildFlags) -buildParserInfo invokedName = - info - (parsedCommandParser flagParsers <**> helper) - ( fullDesc - <> progDesc (helpDescriptionOrSynopsis buildCommand) - <> header ("cabal " ++ invokedName) - <> footer (examples "cabal" invokedName) - ) where + info = parserInfo invokedName examples flagParsers buildCommand flagParsers = cmdOptionParsers (commandOptions buildCommand ParseArgs) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index be4ea11a798..a507ee0a26c 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -37,9 +37,8 @@ import Distribution.Client.CmdInstall.ClientInstallTargetSelector import Distribution.Client.Cmd.UI ( ParsedCommand (..) , cmdOptionParsers - , helpDescriptionOrSynopsis , helpText - , parsedCommandParser + , parserInfo ) import Distribution.Client.Config ( SavedConfig (..) @@ -204,7 +203,7 @@ import Distribution.System , Platform , buildOS ) -import Distribution.Types.InstalledPackageInfo +import qualified Distribution.Types.InstalledPackageInfo as IPI ( InstalledPackageInfo (..) ) import Distribution.Types.PackageId @@ -248,18 +247,10 @@ import Distribution.Utils.NubList ) import Network.URI (URI) import Options.Applicative - ( ParserInfo - , ParserResult (..) + ( ParserResult (..) , defaultPrefs , execParserPure - , footer - , fullDesc - , header - , helper - , info - , progDesc , renderFailure - , (<**>) ) import System.Directory ( copyFile @@ -337,37 +328,9 @@ installCommand = CommandUI { commandName = "v2-install" , commandSynopsis = "Install packages." - , commandUsage = - usageAlternatives - "v2-install" - ["[TARGETS] [FLAGS]"] - , commandDescription = Just $ \_ -> - wrapText $ - "Installs one or more packages. This is done by installing them " - ++ "in the store and symlinking or copying the executables in the directory " - ++ "specified by the --installdir flag (`~/.local/bin/` by default). " - ++ "If you want the installed executables to be available globally, " - ++ "make sure that the PATH environment variable contains that directory. " - ++ "\n\n" - ++ "If TARGET is a library and --lib (provisional) is used, " - ++ "it will be added to the global environment. " - ++ "When doing this, cabal will try to build a plan that includes all " - ++ "the previously installed libraries. This is currently not implemented." - , commandNotes = Just $ \pname -> - "Examples:\n" - ++ " " - ++ pname - ++ " v2-install\n" - ++ " Install the package in the current directory\n" - ++ " " - ++ pname - ++ " v2-install pkgname\n" - ++ " Install the package named pkgname" - ++ " (fetching it from hackage if necessary)\n" - ++ " " - ++ pname - ++ " v2-install ./pkgfoo\n" - ++ " Install the package in the ./pkgfoo directory\n" + , commandUsage = usageAlternatives "v2-install" ["[TARGETS] [FLAGS]"] + , commandDescription = Just $ \_ -> wrapText description + , commandNotes = Just $ \pname -> examples pname "v2-install" , commandOptions = \x -> filter notInstallDirOpt $ nixStyleOptions clientInstallOptions x , commandDefaultFlags = defaultNixStyleFlags defaultClientInstallFlags } @@ -376,6 +339,31 @@ installCommand = notInstallDirOpt x = optionName x `notElem` installDirOptNames installDirOptNames = map optionName installDirsOptions +description :: String +description = + "Installs one or more packages. This is done by installing them " + ++ "in the store and symlinking or copying the executables in the directory " + ++ "specified by the --installdir flag (`~/.local/bin/` by default). " + ++ "If you want the installed executables to be available globally, " + ++ "make sure that the PATH environment variable contains that directory. " + ++ "\n\n" + ++ "If TARGET is a library and --lib (provisional) is used, " + ++ "it will be added to the global environment. " + ++ "When doing this, cabal will try to build a plan that includes all " + ++ "the previously installed libraries. This is currently not implemented." + +examples :: String -> String -> String +examples pname invokedName = + unlines + [ "Examples:" + , " - " <> pname <> " " <> invokedName + , " Install the package in the current directory" + , " - " <> pname <> " " <> invokedName <> " pkgname" + , " Install the package named pkgname (fetching it from hackage if necessary)" + , " - " <> pname <> " " <> invokedName <> " ./pkgfoo" + , " Install the package in the ./pkgfoo directory" + ] + -- | The @install@ command actually serves four different needs. It installs: -- * exes: -- For example a program from hackage. The behavior is similar to the old @@ -1003,7 +991,7 @@ prepareExeInstall installLibraries :: Verbosity -> ProjectBuildContext - -> PI.PackageIndex InstalledPackageInfo + -> PI.PackageIndex IPI.InstalledPackageInfo -> Compiler -> PackageDBStackCWD -> FilePath @@ -1036,7 +1024,7 @@ installLibraries . sortBy (comparing (Down . fst)) . PI.lookupPackageName installedIndex globalLatest = concatMap getLatest globalPackages - globalEntries = GhcEnvFilePackageId . installedUnitId <$> globalLatest + globalEntries = GhcEnvFilePackageId . IPI.installedUnitId <$> globalLatest baseEntries = GhcEnvFileClearPackageDbStack : fmap GhcEnvFilePackageDb packageDbs pkgEntries = @@ -1125,7 +1113,7 @@ environmentFileToSpecifiers environmentFileToSpecifiers ipi = foldMap $ \case (GhcEnvFilePackageId unitId) | Just - InstalledPackageInfo + IPI.InstalledPackageInfo { sourcePackageId = PackageIdentifier{..} , installedUnitId } <- @@ -1459,7 +1447,7 @@ replaceInstallAlias invokedName = parseInstallCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseInstallCommand invokedName cmdArgs = - case execParserPure defaultPrefs (installParserInfo invokedName) cmdArgs of + case execParserPure defaultPrefs info cmdArgs of Success parsed -> if parsedListOptions parsed then CommandList installListOptions @@ -1473,27 +1461,6 @@ parseInstallCommand invokedName cmdArgs = else CommandErrors [msg] CompletionInvoked _ -> CommandErrors ["Shell completion is not supported by this parser path."] - -installParserInfo :: String -> ParserInfo (ParsedCommand ClientInstallFlags) -installParserInfo invokedName = - info - (parsedCommandParser flagParsers <**> helper) - ( fullDesc - <> progDesc (helpDescriptionOrSynopsis installCommand) - <> header ("cabal " ++ invokedName) - <> footer (installExamples invokedName) - ) where + info = parserInfo invokedName examples flagParsers installCommand flagParsers = cmdOptionParsers (commandOptions installCommand ParseArgs) - -installExamples :: String -> String -installExamples invokedName = - unlines - [ "Examples:" - , " - cabal " <> invokedName - , " Install the package in the current directory" - , " - cabal " <> invokedName <> " pkgname" - , " Install the package named pkgname (fetching it from hackage if necessary)" - , " - cabal " <> invokedName <> " ./pkgfoo" - , " Install the package in the ./pkgfoo directory" - ] From dfca880dac7f9fc88074fcdbca2605fdc3a76039 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 13 Aug 2026 14:59:46 -0400 Subject: [PATCH 054/104] Rename to isCommandName --- cabal-install/src/Distribution/Client/CmdBuild.hs | 12 ++++++------ cabal-install/src/Distribution/Client/CmdInstall.hs | 12 ++++++------ cabal-install/src/Distribution/Client/Main.hs | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 69ba2ecc214..1b57057eab2 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -7,7 +7,7 @@ module Distribution.Client.CmdBuild cmdSpec , buildAction , parseBuildCommand - , isBuildCommandName + , isCommandName , BuildFlags (..) , defaultBuildFlags @@ -265,13 +265,13 @@ reportCannotPruneDependencies verbosity = -- | The command name and aliases for the @build@ command. -- --- >>> buildCommandNames +-- >>> commandNames -- ["build","new-build","v2-build"] -buildCommandNames :: [String] -buildCommandNames = ["build", "new-build", commandName buildCommand] +commandNames :: [String] +commandNames = ["build", "new-build", commandName buildCommand] -isBuildCommandName :: String -> Bool -isBuildCommandName name = name `elem` buildCommandNames +isCommandName :: String -> Bool +isCommandName name = name `elem` commandNames buildListOptions :: [String] buildListOptions = diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index a507ee0a26c..24a6a65ae1b 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -9,7 +9,7 @@ module Distribution.Client.CmdInstall , installCommand , installAction , parseInstallCommand - , isInstallCommandName + , isCommandName -- * Internals exposed for testing , selectPackageTargets @@ -1427,13 +1427,13 @@ reportCannotPruneDependencies verbosity = -- | The command name and aliases for the @install@ command. -- --- >>> installCommandNames +-- >>> commandNames -- ["install","new-install","v2-install"] -installCommandNames :: [String] -installCommandNames = ["install", "new-install", commandName installCommand] +commandNames :: [String] +commandNames = ["install", "new-install", commandName installCommand] -isInstallCommandName :: String -> Bool -isInstallCommandName name = name `elem` installCommandNames +isCommandName :: String -> Bool +isCommandName name = name `elem` commandNames installListOptions :: [String] installListOptions = diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index b4bf4b3fd31..4720d0bf840 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -390,10 +390,10 @@ mainWorker args = do CommandReadyToGo (mkGlobalFlags, cmdArgs0) -> case cmdArgs0 of (cmdName : cmdArgs) - | CmdBuild.isBuildCommandName cmdName -> + | CmdBuild.isCommandName cmdName -> let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) in Just $ CommandReadyToGo (globalFlags, CmdBuild.parseBuildCommand cmdName cmdArgs) - | CmdInstall.isInstallCommandName cmdName -> + | CmdInstall.isCommandName cmdName -> let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) in Just $ CommandReadyToGo (globalFlags, CmdInstall.parseInstallCommand cmdName cmdArgs) _ -> Nothing From ac47e9c434a433369eb2aa2c92d622dce0e0f178 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 13 Aug 2026 15:07:51 -0400 Subject: [PATCH 055/104] Rename to parseCommand --- .../src/Distribution/Client/CmdBuild.hs | 16 +++++++++------- .../src/Distribution/Client/CmdInstall.hs | 14 ++++++++------ cabal-install/src/Distribution/Client/Main.hs | 4 ++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 1b57057eab2..35562214421 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -3,14 +3,16 @@ -- | cabal-install CLI command: build module Distribution.Client.CmdBuild - ( -- * The @build@ CLI and action - cmdSpec - , buildAction - , parseBuildCommand - , isCommandName + ( -- * The @build@ CLI command UI and action + buildAction , BuildFlags (..) , defaultBuildFlags + -- * The @build@ CLI command spec and parser + , cmdSpec + , isCommandName + , parseCommand + -- * Internals exposed for testing , selectPackageTargets , selectComponentTarget @@ -282,8 +284,8 @@ buildListOptions = replaceBuildAlias :: String -> String -> String replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack invokedName) . T.pack -parseBuildCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) -parseBuildCommand invokedName cmdArgs = +parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) +parseCommand invokedName cmdArgs = case execParserPure defaultPrefs info cmdArgs of Success parsed -> if parsedListOptions parsed diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 24a6a65ae1b..5ca34225a2d 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -4,12 +4,14 @@ -- | cabal-install CLI command: install module Distribution.Client.CmdInstall - ( -- * The @install@ CLI and action - cmdSpec - , installCommand + ( -- * The @install@ CLI command UI and action + installCommand , installAction - , parseInstallCommand + + -- * The @install@ CLI command spec and parser + , cmdSpec , isCommandName + , parseCommand -- * Internals exposed for testing , selectPackageTargets @@ -1445,8 +1447,8 @@ replaceInstallAlias :: String -> String -> String replaceInstallAlias invokedName = T.unpack . T.replace (T.pack "v2-install") (T.pack invokedName) . T.pack -parseInstallCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) -parseInstallCommand invokedName cmdArgs = +parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) +parseCommand invokedName cmdArgs = case execParserPure defaultPrefs info cmdArgs of Success parsed -> if parsedListOptions parsed diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index 4720d0bf840..ca81f1b7ed7 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -392,10 +392,10 @@ mainWorker args = do (cmdName : cmdArgs) | CmdBuild.isCommandName cmdName -> let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) - in Just $ CommandReadyToGo (globalFlags, CmdBuild.parseBuildCommand cmdName cmdArgs) + in Just $ CommandReadyToGo (globalFlags, CmdBuild.parseCommand cmdName cmdArgs) | CmdInstall.isCommandName cmdName -> let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) - in Just $ CommandReadyToGo (globalFlags, CmdInstall.parseInstallCommand cmdName cmdArgs) + in Just $ CommandReadyToGo (globalFlags, CmdInstall.parseCommand cmdName cmdArgs) _ -> Nothing _ -> Nothing From f8823aabe293bd76111764f6c765447459ad385a Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 13 Aug 2026 15:37:34 -0400 Subject: [PATCH 056/104] Use do block to reduce repetition --- cabal-install/src/Distribution/Client/Main.hs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index ca81f1b7ed7..f02e68cdd1b 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -387,16 +387,14 @@ mainWorker args = do parseBuildOrInstallWithOptparse :: [String] -> Maybe (CommandParse (GlobalFlags, CommandParse Action)) parseBuildOrInstallWithOptparse argv = case commandParseArgs globalCmd True argv of - CommandReadyToGo (mkGlobalFlags, cmdArgs0) -> - case cmdArgs0 of - (cmdName : cmdArgs) - | CmdBuild.isCommandName cmdName -> - let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) - in Just $ CommandReadyToGo (globalFlags, CmdBuild.parseCommand cmdName cmdArgs) - | CmdInstall.isCommandName cmdName -> - let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) - in Just $ CommandReadyToGo (globalFlags, CmdInstall.parseCommand cmdName cmdArgs) + CommandReadyToGo (mkGlobalFlags, cmdArgs0) -> do + (cmdParser, cmdName : cmdArgs) <- case cmdArgs0 of + x@(n : _) + | CmdBuild.isCommandName n -> Just (CmdBuild.parseCommand, x) + | CmdInstall.isCommandName n -> Just (CmdInstall.parseCommand, x) _ -> Nothing + let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) + return $ CommandReadyToGo (globalFlags, cmdParser cmdName cmdArgs) _ -> Nothing delegateToExternal From 9013d23317a2b6fc2546e4707714b52bb2c37047 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 13 Aug 2026 15:42:36 -0400 Subject: [PATCH 057/104] Satisfy fourmolu --- cabal-install/src/Distribution/Client/CmdBuild.hs | 2 +- cabal-install/src/Distribution/Client/CmdInstall.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 35562214421..73c96f13e3d 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -8,7 +8,7 @@ module Distribution.Client.CmdBuild , BuildFlags (..) , defaultBuildFlags - -- * The @build@ CLI command spec and parser + -- * The @build@ CLI command spec and parser , cmdSpec , isCommandName , parseCommand diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 5ca34225a2d..1d44a6f12af 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -8,7 +8,7 @@ module Distribution.Client.CmdInstall installCommand , installAction - -- * The @install@ CLI command spec and parser + -- * The @install@ CLI command spec and parser , cmdSpec , isCommandName , parseCommand From e6c2cf5af9830d13f6ffadba3cd7795d5706058f Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sat, 15 Aug 2026 14:20:45 -0400 Subject: [PATCH 058/104] Replace FILTER with values for test-show-details --- Cabal/src/Distribution/Simple/Setup/Test.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cabal/src/Distribution/Simple/Setup/Test.hs b/Cabal/src/Distribution/Simple/Setup/Test.hs index 718cde13305..00b8121e98f 100644 --- a/Cabal/src/Distribution/Simple/Setup/Test.hs +++ b/Cabal/src/Distribution/Simple/Setup/Test.hs @@ -206,7 +206,7 @@ testOptions' showOrParseArgs = testShowDetails (\v flags -> flags{testShowDetails = v}) ( reqArg - "FILTER" + "always|never|failures|streaming|direct" ( parsecToReadE ( \_ -> "--show-details flag expects one of " From a9b3e057932a34e6ce5d552d0ffdc01c85beea29 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sat, 15 Aug 2026 14:23:49 -0400 Subject: [PATCH 059/104] Replace LEVEL with values for remote-build-report --- cabal-install/src/Distribution/Client/Setup.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index c1dd499eeac..f10905a775e 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -2743,7 +2743,7 @@ installOptions showOrParseArgs = installBuildReports (\v flags -> flags{installBuildReports = v}) ( reqArg - "LEVEL" + "none|anonymous|detailed" ( parsecToReadE ( const $ "report level must be 'none', " From 10090dad89cb656967276e61a1f409a3de01935d Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sat, 15 Aug 2026 14:29:38 -0400 Subject: [PATCH 060/104] Sublist for remote-build-reporting options --- cabal-install/src/Distribution/Client/Setup.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index f10905a775e..9b8f3bdd66b 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -2739,7 +2739,13 @@ installOptions showOrParseArgs = , option [] ["remote-build-reporting"] - "Generate build reports to send to a remote server (none, anonymous or detailed)." + ( unlines + [ "Generate build reports to send to a remote server:" + , "- none: do not report," + , "- anonymous: report without identifying information," + , "- detailed: report with full details." + ] + ) installBuildReports (\v flags -> flags{installBuildReports = v}) ( reqArg From bfce5ea969a2dd789c20ce9cfeec550f2e695d38 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sat, 15 Aug 2026 15:27:51 -0400 Subject: [PATCH 061/104] act-as-setup warning and error --- cabal-install/src/Distribution/Client/Main.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index f02e68cdd1b..611a4bcda09 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -232,6 +232,7 @@ import Distribution.Simple.Utils , cabalVersion , createDirectoryIfMissingVerbose , die' + , dieNoWrap , dieNoVerbosity , dieNoWrap , dieWithException From cbf1ec8db8689bc060003ec5947448a000fb7a05 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 08:36:14 -0400 Subject: [PATCH 062/104] HasCallStack for getConfigState --- Cabal/src/Distribution/Simple/Configure.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Configure.hs b/Cabal/src/Distribution/Simple/Configure.hs index 53c3b35caa0..d724e605fd4 100644 --- a/Cabal/src/Distribution/Simple/Configure.hs +++ b/Cabal/src/Distribution/Simple/Configure.hs @@ -73,6 +73,7 @@ module Distribution.Simple.Configure import Control.Monad import Distribution.Compat.Prelude +import GHC.Stack (HasCallStack) import Prelude () import Distribution.Backpack.Configure @@ -81,7 +82,6 @@ import Distribution.Backpack.DescribeUnitId import Distribution.Backpack.Id import Distribution.Backpack.PreExistingComponent import qualified Distribution.Compat.Graph as Graph -import Distribution.Compat.Stack import Distribution.Compiler import Distribution.InstalledPackageInfo (InstalledPackageInfo) import qualified Distribution.InstalledPackageInfo as IPI @@ -253,7 +253,8 @@ instance Exception ConfigStateFileError -- missing, if the file cannot be read, or if the file was created by an older -- version of Cabal. getConfigStateFile - :: Maybe (SymbolicPath CWD (Dir Pkg)) + :: HasCallStack + => Maybe (SymbolicPath CWD (Dir Pkg)) -> SymbolicPath Pkg File -- ^ The file path of the @setup-config@ file. -> IO LocalBuildInfo @@ -279,8 +280,6 @@ getConfigStateFile mbWorkDir setupConfigFile = do throwIO $ ConfigStateFileBadVersion cabalId compId eResult | otherwise = act deferErrorIfBadVersion getStoredValue - where - _ = callStack -- TODO: attach call stack to exception -- | Read the 'localBuildInfoFile', returning either an error or the local build -- info. From 831a798080e00ee65f020b36358fc0760e70aed9 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 08:59:29 -0400 Subject: [PATCH 063/104] Replace BUILD-TYPE with values for BuildType --- cabal-install/src/Distribution/Client/Setup.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index 9b8f3bdd66b..70d521844d5 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -3467,7 +3467,7 @@ actAsSetupCommand = actAsSetupBuildType (\v flags -> flags{actAsSetupBuildType = v}) ( reqArg - "BUILD-TYPE" + placeholder ( parsecToReadE ("Cannot parse build type: " ++) (fmap toFlag parsec) @@ -3476,6 +3476,9 @@ actAsSetupCommand = ) ] } + where + placeholder = intercalate "|" $ map show setupBuildTypes + setupBuildTypes = [Simple, Configure] -- ------------------------------------------------------------ From 75f474608d165799710aeb1a5313accfd4ac5559 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 09:38:12 -0400 Subject: [PATCH 064/104] Move cmdSpec to Cmd.UI --- .../src/Distribution/Client/Cmd/UI.hs | 23 ++++++++++++++++++- .../src/Distribution/Client/CmdBuild.hs | 16 ++----------- .../src/Distribution/Client/CmdInstall.hs | 16 ++----------- 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 049a8fbf220..5f6bd1db219 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -1,4 +1,5 @@ {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} module Distribution.Client.Cmd.UI ( -- * Converting CommandUI options to optparse-applicative parsers @@ -18,6 +19,7 @@ module Distribution.Client.Cmd.UI , parsedCommandParser , cmdItemParser , cmdOptionParsers + , cmdSpec , helpDescriptionOrSynopsis , parserInfo @@ -66,10 +68,13 @@ import Distribution.Client.NixStyleOptions ) import Distribution.ReadE (runReadE) import Distribution.Simple.Command - ( CommandUI (..) + ( CommandSpec (..) + , CommandType (NormalCommand) + , CommandUI (..) , OptDescr (..) , OptionField (..) , ShowOrParseArgs (ShowArgs) + , commandAddAction ) import Distribution.Simple.Utils (ordNub) @@ -110,6 +115,22 @@ data ParsedCommand a = ParsedCommand type Examples = String -> String -> String +cmdSpec + :: CommandUI flags + -> (flags -> [String] -> action) + -> [CommandSpec action] +cmdSpec command action = + [CommandSpec ui (`commandAddAction` action) NormalCommand] + where + defaultMsg = T.unpack . T.replace "v2-" "" . T.pack + ui = + command + { commandName = defaultMsg (commandName command) + , commandUsage = defaultMsg . commandUsage command + , commandDescription = (defaultMsg .) <$> commandDescription command + , commandNotes = (defaultMsg .) <$> commandNotes command + } + parserInfo :: String -> Examples -> [O.Parser (CmdItem a)] -> CommandUI flags -> ParserInfo (ParsedCommand a) parserInfo invokedName examples flagParsers cmdui = info diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 73c96f13e3d..d480d01c797 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -40,6 +40,7 @@ import Distribution.Client.Cmd.UI , helpText , parserInfo ) +import qualified Distribution.Client.Cmd.UI as UI import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -57,10 +58,8 @@ import Distribution.Client.Setup (GlobalFlags, yesNoOpt) import Distribution.Simple.Command ( CommandParse (..) , CommandSpec (..) - , CommandType (..) , CommandUI (..) , ShowOrParseArgs (ParseArgs) - , commandAddAction , commandParseArgs , option , usageAlternatives @@ -76,18 +75,7 @@ import Options.Applicative ) cmdSpec :: [CommandSpec (GlobalFlags -> IO ())] -cmdSpec = [CommandSpec ui (`commandAddAction` buildAction) NormalCommand] - where - defaultMsg = T.unpack . T.replace "v2-" "" . T.pack - CommandUI{..} = buildCommand - - ui = - buildCommand - { commandName = defaultMsg commandName - , commandUsage = defaultMsg . commandUsage - , commandDescription = (defaultMsg .) <$> commandDescription - , commandNotes = (defaultMsg .) <$> commandNotes - } +cmdSpec = UI.cmdSpec buildCommand buildAction buildCommand :: CommandUI (NixStyleFlags BuildFlags) buildCommand = diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 1d44a6f12af..f1e8326f145 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -33,6 +33,7 @@ import Distribution.Client.TargetProblem , TargetProblem' ) +import qualified Distribution.Client.Cmd.UI as UI import Distribution.Client.CmdInstall.ClientInstallFlags import Distribution.Client.CmdInstall.ClientInstallTargetSelector @@ -131,11 +132,9 @@ import Distribution.Simple.BuildPaths import Distribution.Simple.Command ( CommandParse (..) , CommandSpec (..) - , CommandType (..) , CommandUI (..) , OptionField (..) , ShowOrParseArgs (ParseArgs) - , commandAddAction , commandParseArgs , optionName , usageAlternatives @@ -312,18 +311,7 @@ data InstallExe = InstallExe } cmdSpec :: [CommandSpec (GlobalFlags -> IO ())] -cmdSpec = [CommandSpec ui (`commandAddAction` installAction) NormalCommand] - where - defaultMsg = T.unpack . T.replace (T.pack "v2-") (T.pack "") . T.pack - CommandUI{..} = installCommand - - ui = - installCommand - { commandName = defaultMsg commandName - , commandUsage = defaultMsg . commandUsage - , commandDescription = (defaultMsg .) <$> commandDescription - , commandNotes = (defaultMsg .) <$> commandNotes - } +cmdSpec = UI.cmdSpec installCommand installAction installCommand :: CommandUI (NixStyleFlags ClientInstallFlags) installCommand = From f086239351ad4891ac5bc5a7ecd39e57dc4a3cfe Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 09:54:00 -0400 Subject: [PATCH 065/104] Use Cmd.UI.cmdSpec --- cabal-install/src/Distribution/Client/CmdBuild.hs | 9 ++------- cabal-install/src/Distribution/Client/CmdInstall.hs | 6 ------ cabal-install/src/Distribution/Client/Main.hs | 6 +++--- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index d480d01c797..dfd8bf8f5d4 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -4,12 +4,12 @@ -- | cabal-install CLI command: build module Distribution.Client.CmdBuild ( -- * The @build@ CLI command UI and action - buildAction + buildCommand + , buildAction , BuildFlags (..) , defaultBuildFlags -- * The @build@ CLI command spec and parser - , cmdSpec , isCommandName , parseCommand @@ -40,7 +40,6 @@ import Distribution.Client.Cmd.UI , helpText , parserInfo ) -import qualified Distribution.Client.Cmd.UI as UI import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -57,7 +56,6 @@ import Distribution.Client.ScriptUtils import Distribution.Client.Setup (GlobalFlags, yesNoOpt) import Distribution.Simple.Command ( CommandParse (..) - , CommandSpec (..) , CommandUI (..) , ShowOrParseArgs (ParseArgs) , commandParseArgs @@ -74,9 +72,6 @@ import Options.Applicative , renderFailure ) -cmdSpec :: [CommandSpec (GlobalFlags -> IO ())] -cmdSpec = UI.cmdSpec buildCommand buildAction - buildCommand :: CommandUI (NixStyleFlags BuildFlags) buildCommand = CommandUI diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index f1e8326f145..29a5cb6f58e 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -9,7 +9,6 @@ module Distribution.Client.CmdInstall , installAction -- * The @install@ CLI command spec and parser - , cmdSpec , isCommandName , parseCommand @@ -33,7 +32,6 @@ import Distribution.Client.TargetProblem , TargetProblem' ) -import qualified Distribution.Client.Cmd.UI as UI import Distribution.Client.CmdInstall.ClientInstallFlags import Distribution.Client.CmdInstall.ClientInstallTargetSelector @@ -131,7 +129,6 @@ import Distribution.Simple.BuildPaths ) import Distribution.Simple.Command ( CommandParse (..) - , CommandSpec (..) , CommandUI (..) , OptionField (..) , ShowOrParseArgs (ParseArgs) @@ -310,9 +307,6 @@ data InstallExe = InstallExe -- store. } -cmdSpec :: [CommandSpec (GlobalFlags -> IO ())] -cmdSpec = UI.cmdSpec installCommand installAction - installCommand :: CommandUI (NixStyleFlags ClientInstallFlags) installCommand = CommandUI diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index 611a4bcda09..124dfe92dd4 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -182,6 +182,7 @@ import Distribution.PackageDescription , buildable ) +import Distribution.Client.Cmd.UI (cmdSpec) import Distribution.Client.Errors import Distribution.Compat.ResponseFile import Distribution.PackageDescription.PrettyPrint @@ -232,7 +233,6 @@ import Distribution.Simple.Utils , cabalVersion , createDirectoryIfMissingVerbose , die' - , dieNoWrap , dieNoVerbosity , dieNoWrap , dieWithException @@ -500,14 +500,14 @@ mainWorker args = do ++ concat [ newCmd CmdConfigure.configureCommand CmdConfigure.configureAction , newCmd CmdUpdate.updateCommand CmdUpdate.updateAction - , CmdBuild.cmdSpec + , cmdSpec CmdBuild.buildCommand CmdBuild.buildAction , newCmd CmdRepl.replCommand CmdRepl.replAction , newCmd CmdFreeze.freezeCommand CmdFreeze.freezeAction , newCmd CmdHaddock.haddockCommand CmdHaddock.haddockAction , newCmd CmdHaddockProject.haddockProjectCommand CmdHaddockProject.haddockProjectAction - , CmdInstall.cmdSpec + , cmdSpec CmdInstall.installCommand CmdInstall.installAction , newCmd CmdRun.runCommand CmdRun.runAction , newCmd CmdTest.testCommand CmdTest.testAction , newCmd CmdBench.benchCommand CmdBench.benchAction From 9e5b74b4acc99c188f7f8093c76f7bed6e0daa29 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 10:00:07 -0400 Subject: [PATCH 066/104] Move parseCommand to Cmd.UI --- .../src/Distribution/Client/Cmd/UI.hs | 36 ++++++++++++++++- .../src/Distribution/Client/CmdBuild.hs | 39 ++++++------------- .../src/Distribution/Client/CmdInstall.hs | 39 ++++++------------- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 5f6bd1db219..4fa61db7934 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -20,6 +20,7 @@ module Distribution.Client.Cmd.UI , cmdItemParser , cmdOptionParsers , cmdSpec + , parseCommand , helpDescriptionOrSynopsis , parserInfo @@ -68,7 +69,8 @@ import Distribution.Client.NixStyleOptions ) import Distribution.ReadE (runReadE) import Distribution.Simple.Command - ( CommandSpec (..) + ( CommandParse (..) + , CommandSpec (..) , CommandType (NormalCommand) , CommandUI (..) , OptDescr (..) @@ -80,7 +82,10 @@ import Distribution.Simple.Utils (ordNub) import Options.Applicative ( ParserInfo + , ParserResult (..) , asum + , defaultPrefs + , execParserPure , flag' , footer , fullDesc @@ -91,6 +96,7 @@ import Options.Applicative , long , metavar , progDesc + , renderFailure , strArgument , (<**>) ) @@ -131,6 +137,34 @@ cmdSpec command action = , commandNotes = (defaultMsg .) <$> commandNotes command } +parseCommand + :: String + -> [String] + -> Examples + -> [O.Parser (CmdItem a)] + -> CommandUI (NixStyleFlags a) + -> [String] + -> (NixStyleFlags a -> [String] -> action) + -> ReplaceCommandAlias + -> CommandParse action +parseCommand invokedName cmdArgs examples flagParsers cmdui listOptions action replaceAlias = + case execParserPure defaultPrefs pInfo cmdArgs of + Success parsed -> + if parsedListOptions parsed + then CommandList listOptions + else + let flags = appEndo (parsedFlagEdits parsed) (commandDefaultFlags cmdui) + in CommandReadyToGo (action flags (parsedTargets parsed)) + Failure failure -> + let (msg, exitCode) = renderFailure failure ("cabal " ++ invokedName) + in if exitCode == ExitSuccess + then CommandHelp (helpText replaceAlias cmdui invokedName) + else CommandErrors [msg] + CompletionInvoked _ -> + CommandErrors ["Shell completion is not supported by this parser path."] + where + pInfo = parserInfo invokedName examples flagParsers cmdui + parserInfo :: String -> Examples -> [O.Parser (CmdItem a)] -> CommandUI flags -> ParserInfo (ParsedCommand a) parserInfo invokedName examples flagParsers cmdui = info diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index dfd8bf8f5d4..44daa471511 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -32,14 +32,11 @@ import Distribution.Client.TargetProblem ) import qualified Data.Map as Map -import Data.Monoid (Endo (..), appEndo) import qualified Data.Text as T import Distribution.Client.Cmd.UI - ( ParsedCommand (..) - , cmdOptionParsers - , helpText - , parserInfo + ( cmdOptionParsers ) +import qualified Distribution.Client.Cmd.UI as Cmd.UI import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -65,12 +62,6 @@ import Distribution.Simple.Command import Distribution.Simple.Flag (Flag, fromFlag, toFlag) import Distribution.Simple.Utils (dieWithException, wrapText) import Distribution.Verbosity (normal) -import Options.Applicative - ( ParserResult (..) - , defaultPrefs - , execParserPure - , renderFailure - ) buildCommand :: CommandUI (NixStyleFlags BuildFlags) buildCommand = @@ -269,20 +260,12 @@ replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseCommand invokedName cmdArgs = - case execParserPure defaultPrefs info cmdArgs of - Success parsed -> - if parsedListOptions parsed - then CommandList buildListOptions - else - let flags = appEndo (parsedFlagEdits parsed) (commandDefaultFlags buildCommand) - in CommandReadyToGo (buildAction flags (parsedTargets parsed)) - Failure failure -> - let (msg, exitCode) = renderFailure failure ("cabal " ++ invokedName) - in if exitCode == ExitSuccess - then CommandHelp (helpText replaceBuildAlias buildCommand invokedName) - else CommandErrors [msg] - CompletionInvoked _ -> - CommandErrors ["Shell completion is not supported by this parser path."] - where - info = parserInfo invokedName examples flagParsers buildCommand - flagParsers = cmdOptionParsers (commandOptions buildCommand ParseArgs) + Cmd.UI.parseCommand + invokedName + cmdArgs + examples + (cmdOptionParsers (commandOptions buildCommand ParseArgs)) + buildCommand + buildListOptions + buildAction + replaceBuildAlias diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 29a5cb6f58e..40814d4a377 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -36,11 +36,9 @@ import Distribution.Client.CmdInstall.ClientInstallFlags import Distribution.Client.CmdInstall.ClientInstallTargetSelector import Distribution.Client.Cmd.UI - ( ParsedCommand (..) - , cmdOptionParsers - , helpText - , parserInfo + ( cmdOptionParsers ) +import qualified Distribution.Client.Cmd.UI as Cmd.UI import Distribution.Client.Config ( SavedConfig (..) , defaultInstallPath @@ -233,7 +231,6 @@ import Distribution.Verbosity import qualified Data.ByteString.Lazy.Char8 as BS import qualified Data.List.NonEmpty as NE import qualified Data.Map as Map -import Data.Monoid (Endo (..), appEndo) import Data.Ord ( Down (..) ) @@ -244,12 +241,6 @@ import Distribution.Utils.NubList ( fromNubList ) import Network.URI (URI) -import Options.Applicative - ( ParserResult (..) - , defaultPrefs - , execParserPure - , renderFailure - ) import System.Directory ( copyFile , createDirectoryIfMissing @@ -1431,20 +1422,12 @@ replaceInstallAlias invokedName = parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseCommand invokedName cmdArgs = - case execParserPure defaultPrefs info cmdArgs of - Success parsed -> - if parsedListOptions parsed - then CommandList installListOptions - else - let flags = appEndo (parsedFlagEdits parsed) (commandDefaultFlags installCommand) - in CommandReadyToGo (installAction flags (parsedTargets parsed)) - Failure failure -> - let (msg, exitCode) = renderFailure failure ("cabal " ++ invokedName) - in if exitCode == ExitSuccess - then CommandHelp (helpText replaceInstallAlias installCommand invokedName) - else CommandErrors [msg] - CompletionInvoked _ -> - CommandErrors ["Shell completion is not supported by this parser path."] - where - info = parserInfo invokedName examples flagParsers installCommand - flagParsers = cmdOptionParsers (commandOptions installCommand ParseArgs) + Cmd.UI.parseCommand + invokedName + cmdArgs + examples + (cmdOptionParsers (commandOptions installCommand ParseArgs)) + installCommand + installListOptions + installAction + replaceInstallAlias From a47fe5b67da2a2b3ae7a192d5f9b3a68e415553d Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 10:06:30 -0400 Subject: [PATCH 067/104] Move replaceCommandAlias to Cmd.UI --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 5 +++++ cabal-install/src/Distribution/Client/CmdBuild.hs | 7 ++----- cabal-install/src/Distribution/Client/CmdInstall.hs | 8 ++------ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 4fa61db7934..4abcf9ac159 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -21,6 +21,7 @@ module Distribution.Client.Cmd.UI , cmdOptionParsers , cmdSpec , parseCommand + , replaceCommandAlias , helpDescriptionOrSynopsis , parserInfo @@ -121,6 +122,10 @@ data ParsedCommand a = ParsedCommand type Examples = String -> String -> String +replaceCommandAlias :: String -> ReplaceCommandAlias +replaceCommandAlias commandName invokedName = + T.unpack . T.replace (T.pack commandName) (T.pack invokedName) . T.pack + cmdSpec :: CommandUI flags -> (flags -> [String] -> action) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 44daa471511..7ce3aeedcbf 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -32,9 +32,9 @@ import Distribution.Client.TargetProblem ) import qualified Data.Map as Map -import qualified Data.Text as T import Distribution.Client.Cmd.UI ( cmdOptionParsers + , replaceCommandAlias ) import qualified Distribution.Client.Cmd.UI as Cmd.UI import Distribution.Client.Errors @@ -255,9 +255,6 @@ buildListOptions = CommandList opts -> opts _ -> [] -replaceBuildAlias :: String -> String -> String -replaceBuildAlias invokedName = T.unpack . T.replace (T.pack "v2-build") (T.pack invokedName) . T.pack - parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseCommand invokedName cmdArgs = Cmd.UI.parseCommand @@ -268,4 +265,4 @@ parseCommand invokedName cmdArgs = buildCommand buildListOptions buildAction - replaceBuildAlias + (replaceCommandAlias (commandName buildCommand)) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 40814d4a377..bb1433fd5c1 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -37,6 +37,7 @@ import Distribution.Client.CmdInstall.ClientInstallTargetSelector import Distribution.Client.Cmd.UI ( cmdOptionParsers + , replaceCommandAlias ) import qualified Distribution.Client.Cmd.UI as Cmd.UI import Distribution.Client.Config @@ -235,7 +236,6 @@ import Data.Ord ( Down (..) ) import qualified Data.Set as S -import qualified Data.Text as T import Distribution.Client.Errors import Distribution.Utils.NubList ( fromNubList @@ -1416,10 +1416,6 @@ installListOptions = CommandList opts -> opts _ -> [] -replaceInstallAlias :: String -> String -> String -replaceInstallAlias invokedName = - T.unpack . T.replace (T.pack "v2-install") (T.pack invokedName) . T.pack - parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseCommand invokedName cmdArgs = Cmd.UI.parseCommand @@ -1430,4 +1426,4 @@ parseCommand invokedName cmdArgs = installCommand installListOptions installAction - replaceInstallAlias + (replaceCommandAlias (commandName installCommand)) From cf472612d7ff8cf081c0522ce474f13cd9b97595 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 10:08:03 -0400 Subject: [PATCH 068/104] Move cmdListOptions to Cmd.UI --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 8 ++++++++ cabal-install/src/Distribution/Client/CmdBuild.hs | 12 +++--------- cabal-install/src/Distribution/Client/CmdInstall.hs | 12 +++--------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 4abcf9ac159..d64331bdf7a 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -20,6 +20,7 @@ module Distribution.Client.Cmd.UI , cmdItemParser , cmdOptionParsers , cmdSpec + , cmdListOptions , parseCommand , replaceCommandAlias , helpDescriptionOrSynopsis @@ -78,6 +79,7 @@ import Distribution.Simple.Command , OptionField (..) , ShowOrParseArgs (ShowArgs) , commandAddAction + , commandParseArgs ) import Distribution.Simple.Utils (ordNub) @@ -142,6 +144,12 @@ cmdSpec command action = , commandNotes = (defaultMsg .) <$> commandNotes command } +cmdListOptions :: CommandUI flags -> [String] +cmdListOptions command = + case commandParseArgs command False ["--list-options"] of + CommandList opts -> opts + _ -> [] + parseCommand :: String -> [String] diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 7ce3aeedcbf..1339a4a64ca 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -33,7 +33,8 @@ import Distribution.Client.TargetProblem import qualified Data.Map as Map import Distribution.Client.Cmd.UI - ( cmdOptionParsers + ( cmdListOptions + , cmdOptionParsers , replaceCommandAlias ) import qualified Distribution.Client.Cmd.UI as Cmd.UI @@ -55,7 +56,6 @@ import Distribution.Simple.Command ( CommandParse (..) , CommandUI (..) , ShowOrParseArgs (ParseArgs) - , commandParseArgs , option , usageAlternatives ) @@ -249,12 +249,6 @@ commandNames = ["build", "new-build", commandName buildCommand] isCommandName :: String -> Bool isCommandName name = name `elem` commandNames -buildListOptions :: [String] -buildListOptions = - case commandParseArgs buildCommand False ["--list-options"] of - CommandList opts -> opts - _ -> [] - parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseCommand invokedName cmdArgs = Cmd.UI.parseCommand @@ -263,6 +257,6 @@ parseCommand invokedName cmdArgs = examples (cmdOptionParsers (commandOptions buildCommand ParseArgs)) buildCommand - buildListOptions + (cmdListOptions buildCommand) buildAction (replaceCommandAlias (commandName buildCommand)) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index bb1433fd5c1..1ae2169be4e 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -36,7 +36,8 @@ import Distribution.Client.CmdInstall.ClientInstallFlags import Distribution.Client.CmdInstall.ClientInstallTargetSelector import Distribution.Client.Cmd.UI - ( cmdOptionParsers + ( cmdListOptions + , cmdOptionParsers , replaceCommandAlias ) import qualified Distribution.Client.Cmd.UI as Cmd.UI @@ -131,7 +132,6 @@ import Distribution.Simple.Command , CommandUI (..) , OptionField (..) , ShowOrParseArgs (ParseArgs) - , commandParseArgs , optionName , usageAlternatives ) @@ -1410,12 +1410,6 @@ commandNames = ["install", "new-install", commandName installCommand] isCommandName :: String -> Bool isCommandName name = name `elem` commandNames -installListOptions :: [String] -installListOptions = - case commandParseArgs installCommand False ["--list-options"] of - CommandList opts -> opts - _ -> [] - parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseCommand invokedName cmdArgs = Cmd.UI.parseCommand @@ -1424,6 +1418,6 @@ parseCommand invokedName cmdArgs = examples (cmdOptionParsers (commandOptions installCommand ParseArgs)) installCommand - installListOptions + (cmdListOptions installCommand) installAction (replaceCommandAlias (commandName installCommand)) From 41604f6ce984a20aa6dedefa51ebca2f0a0f9882 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 10:15:45 -0400 Subject: [PATCH 069/104] Change arg order of parseCommand --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 15 +++++++-------- cabal-install/src/Distribution/Client/CmdBuild.hs | 11 ++--------- .../src/Distribution/Client/CmdInstall.hs | 11 ++--------- 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index d64331bdf7a..30c059d9f43 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -77,7 +77,7 @@ import Distribution.Simple.Command , CommandUI (..) , OptDescr (..) , OptionField (..) - , ShowOrParseArgs (ShowArgs) + , ShowOrParseArgs (..) , commandAddAction , commandParseArgs ) @@ -151,20 +151,18 @@ cmdListOptions command = _ -> [] parseCommand - :: String - -> [String] - -> Examples - -> [O.Parser (CmdItem a)] + :: Examples -> CommandUI (NixStyleFlags a) - -> [String] -> (NixStyleFlags a -> [String] -> action) -> ReplaceCommandAlias + -> String + -> [String] -> CommandParse action -parseCommand invokedName cmdArgs examples flagParsers cmdui listOptions action replaceAlias = +parseCommand examples cmdui action replaceAlias invokedName cmdArgs = case execParserPure defaultPrefs pInfo cmdArgs of Success parsed -> if parsedListOptions parsed - then CommandList listOptions + then CommandList (cmdListOptions cmdui) else let flags = appEndo (parsedFlagEdits parsed) (commandDefaultFlags cmdui) in CommandReadyToGo (action flags (parsedTargets parsed)) @@ -177,6 +175,7 @@ parseCommand invokedName cmdArgs examples flagParsers cmdui listOptions action r CommandErrors ["Shell completion is not supported by this parser path."] where pInfo = parserInfo invokedName examples flagParsers cmdui + flagParsers = cmdOptionParsers (commandOptions cmdui ParseArgs) parserInfo :: String -> Examples -> [O.Parser (CmdItem a)] -> CommandUI flags -> ParserInfo (ParsedCommand a) parserInfo invokedName examples flagParsers cmdui = diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 1339a4a64ca..f6a59af6f87 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -33,9 +33,7 @@ import Distribution.Client.TargetProblem import qualified Data.Map as Map import Distribution.Client.Cmd.UI - ( cmdListOptions - , cmdOptionParsers - , replaceCommandAlias + ( replaceCommandAlias ) import qualified Distribution.Client.Cmd.UI as Cmd.UI import Distribution.Client.Errors @@ -55,7 +53,6 @@ import Distribution.Client.Setup (GlobalFlags, yesNoOpt) import Distribution.Simple.Command ( CommandParse (..) , CommandUI (..) - , ShowOrParseArgs (ParseArgs) , option , usageAlternatives ) @@ -250,13 +247,9 @@ isCommandName :: String -> Bool isCommandName name = name `elem` commandNames parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) -parseCommand invokedName cmdArgs = +parseCommand = Cmd.UI.parseCommand - invokedName - cmdArgs examples - (cmdOptionParsers (commandOptions buildCommand ParseArgs)) buildCommand - (cmdListOptions buildCommand) buildAction (replaceCommandAlias (commandName buildCommand)) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 1ae2169be4e..89bbf441cff 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -36,9 +36,7 @@ import Distribution.Client.CmdInstall.ClientInstallFlags import Distribution.Client.CmdInstall.ClientInstallTargetSelector import Distribution.Client.Cmd.UI - ( cmdListOptions - , cmdOptionParsers - , replaceCommandAlias + ( replaceCommandAlias ) import qualified Distribution.Client.Cmd.UI as Cmd.UI import Distribution.Client.Config @@ -131,7 +129,6 @@ import Distribution.Simple.Command ( CommandParse (..) , CommandUI (..) , OptionField (..) - , ShowOrParseArgs (ParseArgs) , optionName , usageAlternatives ) @@ -1411,13 +1408,9 @@ isCommandName :: String -> Bool isCommandName name = name `elem` commandNames parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) -parseCommand invokedName cmdArgs = +parseCommand = Cmd.UI.parseCommand - invokedName - cmdArgs examples - (cmdOptionParsers (commandOptions installCommand ParseArgs)) installCommand - (cmdListOptions installCommand) installAction (replaceCommandAlias (commandName installCommand)) From 10e5be143e57cf0985f312e7ec97651906702ad6 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 10:21:32 -0400 Subject: [PATCH 070/104] Simplify CommandReadyToGo --- cabal-install/src/Distribution/Client/Main.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index 124dfe92dd4..0c00a406333 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -389,14 +389,16 @@ mainWorker args = do parseBuildOrInstallWithOptparse argv = case commandParseArgs globalCmd True argv of CommandReadyToGo (mkGlobalFlags, cmdArgs0) -> do - (cmdParser, cmdName : cmdArgs) <- case cmdArgs0 of - x@(n : _) - | CmdBuild.isCommandName n -> Just (CmdBuild.parseCommand, x) - | CmdInstall.isCommandName n -> Just (CmdInstall.parseCommand, x) - _ -> Nothing + cmdName : cmdArgs <- pure cmdArgs0 + cmdParser <- parserForCommand cmdName let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) return $ CommandReadyToGo (globalFlags, cmdParser cmdName cmdArgs) _ -> Nothing + where + parserForCommand name + | CmdBuild.isCommandName name = Just CmdBuild.parseCommand + | CmdInstall.isCommandName name = Just CmdInstall.parseCommand + | otherwise = Nothing delegateToExternal :: [Command Action] From 931efca93a8456d1041c7458021c6071cf0aac83 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 10:26:40 -0400 Subject: [PATCH 071/104] Satisfy HLint --- cabal-install/src/Distribution/Client/CmdBuild.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index f6a59af6f87..018374d1091 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} -- | cabal-install CLI command: build module Distribution.Client.CmdBuild From b1d6e7a4ed147a1b9102bbddb691e95e079b54ba Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 13:57:35 -0400 Subject: [PATCH 072/104] Move changes to one region of module --- .../src/Distribution/Client/CmdBuild.hs | 82 +++++++++---------- .../src/Distribution/Client/CmdInstall.hs | 66 +++++++-------- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 018374d1091..933d489abf9 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -59,29 +59,23 @@ import Distribution.Simple.Flag (Flag, fromFlag, toFlag) import Distribution.Simple.Utils (dieWithException, wrapText) import Distribution.Verbosity (normal) -buildCommand :: CommandUI (NixStyleFlags BuildFlags) -buildCommand = - CommandUI - { commandName = "v2-build" - , commandSynopsis = "Compile targets within the project." - , commandUsage = usageAlternatives "v2-build" ["[TARGETS] [FLAGS]"] - , commandDescription = Just $ \_ -> wrapText description - , commandNotes = Just $ \pname -> examples pname "v2-build" - , commandDefaultFlags = defaultNixStyleFlags defaultBuildFlags - , commandOptions = - removeIgnoreProjectOption - . nixStyleOptions - ( \showOrParseArgs -> - [ option - [] - ["only-configure"] - "Instead of performing a full build just run the configure step" - buildOnlyConfigure - (\v flags -> flags{buildOnlyConfigure = v}) - (yesNoOpt showOrParseArgs) - ] - ) - } +-- | The command name and aliases for the @build@ command. +-- +-- >>> commandNames +-- ["build","new-build","v2-build"] +commandNames :: [String] +commandNames = ["build", "new-build", commandName buildCommand] + +isCommandName :: String -> Bool +isCommandName name = name `elem` commandNames + +parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) +parseCommand = + Cmd.UI.parseCommand + examples + buildCommand + buildAction + (replaceCommandAlias (commandName buildCommand)) description :: String description = @@ -112,6 +106,30 @@ examples pname invokedName = , " Build the component in profiling mode (including dependencies as needed)" ] +buildCommand :: CommandUI (NixStyleFlags BuildFlags) +buildCommand = + CommandUI + { commandName = "v2-build" + , commandSynopsis = "Compile targets within the project." + , commandUsage = usageAlternatives "v2-build" ["[TARGETS] [FLAGS]"] + , commandDescription = Just $ \_ -> wrapText description + , commandNotes = Just $ \pname -> examples pname "v2-build" + , commandDefaultFlags = defaultNixStyleFlags defaultBuildFlags + , commandOptions = + removeIgnoreProjectOption + . nixStyleOptions + ( \showOrParseArgs -> + [ option + [] + ["only-configure"] + "Instead of performing a full build just run the configure step" + buildOnlyConfigure + (\v flags -> flags{buildOnlyConfigure = v}) + (yesNoOpt showOrParseArgs) + ] + ) + } + data BuildFlags = BuildFlags { buildOnlyConfigure :: Flag Bool } @@ -234,21 +252,3 @@ reportBuildTargetProblems verbosity problems = reportCannotPruneDependencies :: Verbosity -> CannotPruneDependencies -> IO a reportCannotPruneDependencies verbosity = dieWithException verbosity . ReportCannotPruneDependencies . renderCannotPruneDependencies - --- | The command name and aliases for the @build@ command. --- --- >>> commandNames --- ["build","new-build","v2-build"] -commandNames :: [String] -commandNames = ["build", "new-build", commandName buildCommand] - -isCommandName :: String -> Bool -isCommandName name = name `elem` commandNames - -parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) -parseCommand = - Cmd.UI.parseCommand - examples - buildCommand - buildAction - (replaceCommandAlias (commandName buildCommand)) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index 89bbf441cff..e4d2090dff7 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -295,21 +295,23 @@ data InstallExe = InstallExe -- store. } -installCommand :: CommandUI (NixStyleFlags ClientInstallFlags) -installCommand = - CommandUI - { commandName = "v2-install" - , commandSynopsis = "Install packages." - , commandUsage = usageAlternatives "v2-install" ["[TARGETS] [FLAGS]"] - , commandDescription = Just $ \_ -> wrapText description - , commandNotes = Just $ \pname -> examples pname "v2-install" - , commandOptions = \x -> filter notInstallDirOpt $ nixStyleOptions clientInstallOptions x - , commandDefaultFlags = defaultNixStyleFlags defaultClientInstallFlags - } - where - -- install doesn't take installDirs flags, since it always installs into the store in a fixed way. - notInstallDirOpt x = optionName x `notElem` installDirOptNames - installDirOptNames = map optionName installDirsOptions +-- | The command name and aliases for the @install@ command. +-- +-- >>> commandNames +-- ["install","new-install","v2-install"] +commandNames :: [String] +commandNames = ["install", "new-install", commandName installCommand] + +isCommandName :: String -> Bool +isCommandName name = name `elem` commandNames + +parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) +parseCommand = + Cmd.UI.parseCommand + examples + installCommand + installAction + (replaceCommandAlias (commandName installCommand)) description :: String description = @@ -336,6 +338,22 @@ examples pname invokedName = , " Install the package in the ./pkgfoo directory" ] +installCommand :: CommandUI (NixStyleFlags ClientInstallFlags) +installCommand = + CommandUI + { commandName = "v2-install" + , commandSynopsis = "Install packages." + , commandUsage = usageAlternatives "v2-install" ["[TARGETS] [FLAGS]"] + , commandDescription = Just $ \_ -> wrapText description + , commandNotes = Just $ \pname -> examples pname "v2-install" + , commandOptions = \x -> filter notInstallDirOpt $ nixStyleOptions clientInstallOptions x + , commandDefaultFlags = defaultNixStyleFlags defaultClientInstallFlags + } + where + -- install doesn't take installDirs flags, since it always installs into the store in a fixed way. + notInstallDirOpt x = optionName x `notElem` installDirOptNames + installDirOptNames = map optionName installDirsOptions + -- | The @install@ command actually serves four different needs. It installs: -- * exes: -- For example a program from hackage. The behavior is similar to the old @@ -1396,21 +1414,3 @@ reportBuildTargetProblems verbosity problems = reportTargetProblems verbosity "b reportCannotPruneDependencies :: Verbosity -> CannotPruneDependencies -> IO a reportCannotPruneDependencies verbosity = dieWithException verbosity . SelectComponentTargetError . renderCannotPruneDependencies - --- | The command name and aliases for the @install@ command. --- --- >>> commandNames --- ["install","new-install","v2-install"] -commandNames :: [String] -commandNames = ["install", "new-install", commandName installCommand] - -isCommandName :: String -> Bool -isCommandName name = name `elem` commandNames - -parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) -parseCommand = - Cmd.UI.parseCommand - examples - installCommand - installAction - (replaceCommandAlias (commandName installCommand)) From 84710758aeac4a5c1a71fb50722fc629fee1f5d8 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 14:06:41 -0400 Subject: [PATCH 073/104] Get rid of isCommandName --- cabal-install/src/Distribution/Client/CmdBuild.hs | 1 - cabal-install/src/Distribution/Client/CmdInstall.hs | 11 ----------- cabal-install/src/Distribution/Client/Main.hs | 4 ++-- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 933d489abf9..72406f2e17b 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -9,7 +9,6 @@ module Distribution.Client.CmdBuild , defaultBuildFlags -- * The @build@ CLI command spec and parser - , isCommandName , parseCommand -- * Internals exposed for testing diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index e4d2090dff7..faf20051ece 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -9,7 +9,6 @@ module Distribution.Client.CmdInstall , installAction -- * The @install@ CLI command spec and parser - , isCommandName , parseCommand -- * Internals exposed for testing @@ -295,16 +294,6 @@ data InstallExe = InstallExe -- store. } --- | The command name and aliases for the @install@ command. --- --- >>> commandNames --- ["install","new-install","v2-install"] -commandNames :: [String] -commandNames = ["install", "new-install", commandName installCommand] - -isCommandName :: String -> Bool -isCommandName name = name `elem` commandNames - parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseCommand = Cmd.UI.parseCommand diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index 0c00a406333..c2954562fc5 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -396,8 +396,8 @@ mainWorker args = do _ -> Nothing where parserForCommand name - | CmdBuild.isCommandName name = Just CmdBuild.parseCommand - | CmdInstall.isCommandName name = Just CmdInstall.parseCommand + | name `elem` ["build", "new-build", commandName CmdBuild.buildCommand] = Just CmdBuild.parseCommand + | name `elem` ["install", "new-install", commandName CmdInstall.installCommand] = Just CmdInstall.parseCommand | otherwise = Nothing delegateToExternal From 78bcc563bef1a224d9c435ccd41172ed769f789f Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 14:17:09 -0400 Subject: [PATCH 074/104] Add commandNames --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 17 +++++++++++++++-- .../src/Distribution/Client/CmdBuild.hs | 10 ---------- cabal-install/src/Distribution/Client/Main.hs | 6 +++--- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 30c059d9f43..2f740ebffda 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -21,6 +21,7 @@ module Distribution.Client.Cmd.UI , cmdOptionParsers , cmdSpec , cmdListOptions + , commandNames , parseCommand , replaceCommandAlias , helpDescriptionOrSynopsis @@ -124,9 +125,21 @@ data ParsedCommand a = ParsedCommand type Examples = String -> String -> String +replaceText :: String -> String -> String -> String +replaceText old new = T.unpack . T.replace (T.pack old) (T.pack new) . T.pack + +commandNames :: CommandUI flags -> [String] +commandNames command = + [ replaceText "v2-" "" name + , replaceText "v2-" "new-" name + , name + ] + where + name = commandName command + replaceCommandAlias :: String -> ReplaceCommandAlias replaceCommandAlias commandName invokedName = - T.unpack . T.replace (T.pack commandName) (T.pack invokedName) . T.pack + replaceText commandName invokedName cmdSpec :: CommandUI flags @@ -135,7 +148,7 @@ cmdSpec cmdSpec command action = [CommandSpec ui (`commandAddAction` action) NormalCommand] where - defaultMsg = T.unpack . T.replace "v2-" "" . T.pack + defaultMsg = replaceText "v2-" "" ui = command { commandName = defaultMsg (commandName command) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 72406f2e17b..cf84847a31f 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -58,16 +58,6 @@ import Distribution.Simple.Flag (Flag, fromFlag, toFlag) import Distribution.Simple.Utils (dieWithException, wrapText) import Distribution.Verbosity (normal) --- | The command name and aliases for the @build@ command. --- --- >>> commandNames --- ["build","new-build","v2-build"] -commandNames :: [String] -commandNames = ["build", "new-build", commandName buildCommand] - -isCommandName :: String -> Bool -isCommandName name = name `elem` commandNames - parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) parseCommand = Cmd.UI.parseCommand diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index c2954562fc5..7b02b200a16 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -182,7 +182,7 @@ import Distribution.PackageDescription , buildable ) -import Distribution.Client.Cmd.UI (cmdSpec) +import Distribution.Client.Cmd.UI (cmdSpec, commandNames) import Distribution.Client.Errors import Distribution.Compat.ResponseFile import Distribution.PackageDescription.PrettyPrint @@ -396,8 +396,8 @@ mainWorker args = do _ -> Nothing where parserForCommand name - | name `elem` ["build", "new-build", commandName CmdBuild.buildCommand] = Just CmdBuild.parseCommand - | name `elem` ["install", "new-install", commandName CmdInstall.installCommand] = Just CmdInstall.parseCommand + | name `elem` commandNames CmdBuild.buildCommand = Just CmdBuild.parseCommand + | name `elem` commandNames CmdInstall.installCommand = Just CmdInstall.parseCommand | otherwise = Nothing delegateToExternal From fd73bd6e52d7ee3088cdcc790268923080dddfe3 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 14:22:58 -0400 Subject: [PATCH 075/104] Use replace from generic-sop-lens --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 2f740ebffda..74ccc2471e7 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -125,13 +125,22 @@ data ParsedCommand a = ParsedCommand type Examples = String -> String -> String +-- SEE: generic-sop-lens.hs replaceText :: String -> String -> String -> String -replaceText old new = T.unpack . T.replace (T.pack old) (T.pack new) . T.pack +replaceText needle replacement = go + where + go [] = [] + go input@(char : rest) + | Just remainder <- stripPrefix needle input = replacement ++ go remainder + | otherwise = char : go rest + +replaceV2 :: String -> String -> String +replaceV2 = replaceText "v2-" commandNames :: CommandUI flags -> [String] commandNames command = - [ replaceText "v2-" "" name - , replaceText "v2-" "new-" name + [ replaceV2 "" name + , replaceV2 "new-" name , name ] where @@ -148,7 +157,7 @@ cmdSpec cmdSpec command action = [CommandSpec ui (`commandAddAction` action) NormalCommand] where - defaultMsg = replaceText "v2-" "" + defaultMsg = replaceV2 "" ui = command { commandName = defaultMsg (commandName command) From 791b13a5c74804e4626c3c2e852ab38413449db3 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 14:27:17 -0400 Subject: [PATCH 076/104] Rename defaultMsg to stripVersionPrefix --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 74ccc2471e7..0948bca388f 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -137,9 +137,12 @@ replaceText needle replacement = go replaceV2 :: String -> String -> String replaceV2 = replaceText "v2-" +stripVersionPrefix :: String -> String +stripVersionPrefix = replaceV2 "" + commandNames :: CommandUI flags -> [String] commandNames command = - [ replaceV2 "" name + [ stripVersionPrefix name , replaceV2 "new-" name , name ] @@ -157,13 +160,12 @@ cmdSpec cmdSpec command action = [CommandSpec ui (`commandAddAction` action) NormalCommand] where - defaultMsg = replaceV2 "" ui = command - { commandName = defaultMsg (commandName command) - , commandUsage = defaultMsg . commandUsage command - , commandDescription = (defaultMsg .) <$> commandDescription command - , commandNotes = (defaultMsg .) <$> commandNotes command + { commandName = stripVersionPrefix (commandName command) + , commandUsage = stripVersionPrefix . commandUsage command + , commandDescription = (stripVersionPrefix .) <$> commandDescription command + , commandNotes = (stripVersionPrefix .) <$> commandNotes command } cmdListOptions :: CommandUI flags -> [String] From 2bee3a3885b19da721ccc5bcd3ad543f26afba19 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 14:34:04 -0400 Subject: [PATCH 077/104] Move ReplaceCommandAlias --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 0948bca388f..6ac8ea75538 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -124,6 +124,7 @@ data ParsedCommand a = ParsedCommand } type Examples = String -> String -> String +type ReplaceCommandAlias = String -> String -> String -- SEE: generic-sop-lens.hs replaceText :: String -> String -> String -> String @@ -150,8 +151,7 @@ commandNames command = name = commandName command replaceCommandAlias :: String -> ReplaceCommandAlias -replaceCommandAlias commandName invokedName = - replaceText commandName invokedName +replaceCommandAlias = replaceText cmdSpec :: CommandUI flags @@ -510,8 +510,6 @@ groupPredicates = , (ProgramOverrideOptions, keepProgOptions) ] -type ReplaceCommandAlias = String -> String -> String - helpText :: ReplaceCommandAlias -> CommandUI (NixStyleFlags a) -> String -> String -> String helpText replaceBuildAlias buildCommand invokedName pname = commandSynopsis buildCommand From 82f07fd3d6008b7abb7a1748ca5bf76f8c3e6624 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 21:21:23 -0400 Subject: [PATCH 078/104] Add haddocks to Examples --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 6ac8ea75538..4ce3732ba7c 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -14,6 +14,7 @@ module Distribution.Client.Cmd.UI , optDescrToGetOpt -- * Command data types + , Examples , CmdItem (..) , ParsedCommand (..) , parsedCommandParser @@ -123,7 +124,11 @@ data ParsedCommand a = ParsedCommand , parsedListOptions :: Bool } -type Examples = String -> String -> String +type Examples + = String -- ^ program name + -> String -- ^ command name + -> String -- ^ examples text + type ReplaceCommandAlias = String -> String -> String -- SEE: generic-sop-lens.hs From 3aef2cbbcd4cfff3ce328bac35562793f1901a4e Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 21:26:12 -0400 Subject: [PATCH 079/104] Addhaddocks for ReplaceCommandAlias --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 4ce3732ba7c..22b61716d48 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -15,6 +15,7 @@ module Distribution.Client.Cmd.UI -- * Command data types , Examples + , ReplaceCommandAlias , CmdItem (..) , ParsedCommand (..) , parsedCommandParser @@ -124,12 +125,20 @@ data ParsedCommand a = ParsedCommand , parsedListOptions :: Bool } +-- | Examples text for a command, given the program name and command name. type Examples = String -- ^ program name -> String -- ^ command name -> String -- ^ examples text -type ReplaceCommandAlias = String -> String -> String +-- | Replacements for v2- prefixed commands, such as; +-- +-- * v2-build -> new-build or +-- * v2-build -> build. +type ReplaceCommandAlias + = String -- ^ the new prefix + -> String -- ^ the command + -> String -- ^ the command name with the prefix replaced -- SEE: generic-sop-lens.hs replaceText :: String -> String -> String -> String From e72866fa90d85b63929f14a4ef762af41774fcc6 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 21:39:44 -0400 Subject: [PATCH 080/104] Add haddocks to prefix functions --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 22b61716d48..e0e6248ed7a 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -149,16 +149,21 @@ replaceText needle replacement = go | Just remainder <- stripPrefix needle input = replacement ++ go remainder | otherwise = char : go rest -replaceV2 :: String -> String -> String -replaceV2 = replaceText "v2-" +-- | Puts a prefix before a bare command name. +affixVersionPrefix :: String -> String -> String +affixVersionPrefix = replaceText "v2-" +-- | Removes the v2- prefix from a command name, leaving the bare command name. stripVersionPrefix :: String -> String -stripVersionPrefix = replaceV2 "" +stripVersionPrefix = affixVersionPrefix "" +-- | Assuming a v2- prefix for a command name, for the 'commandName' of the +-- given command, makes a list that includes the bare name, the new- prefixed +-- name, and the v2- prefixed name. commandNames :: CommandUI flags -> [String] commandNames command = [ stripVersionPrefix name - , replaceV2 "new-" name + , affixVersionPrefix "new-" name , name ] where From 4ea6edc1ca7dd767ffcd46a9e9e75d43dcbdb547 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 16 Aug 2026 21:45:09 -0400 Subject: [PATCH 081/104] Add haddocks to replaceCommandAlias --- .../src/Distribution/Client/Cmd/UI.hs | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index e0e6248ed7a..23aeb1a673f 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -126,19 +126,30 @@ data ParsedCommand a = ParsedCommand } -- | Examples text for a command, given the program name and command name. -type Examples - = String -- ^ program name - -> String -- ^ command name - -> String -- ^ examples text +type Examples = + String + -- ^ program name + -> String + -- ^ command name + -> String + -- ^ examples text -- | Replacements for v2- prefixed commands, such as; -- -- * v2-build -> new-build or -- * v2-build -> build. -type ReplaceCommandAlias - = String -- ^ the new prefix - -> String -- ^ the command - -> String -- ^ the command name with the prefix replaced +type ReplaceCommandAlias = + String + -- ^ the new prefix + -> String + -- ^ the command + -> String + -- ^ the command name with the prefix replaced + +-- | Given a v2- prefixed command name, returns a function for replacing that +-- prefix with a new prefix. +replaceCommandAlias :: String -> ReplaceCommandAlias +replaceCommandAlias = replaceText -- SEE: generic-sop-lens.hs replaceText :: String -> String -> String -> String @@ -169,9 +180,6 @@ commandNames command = where name = commandName command -replaceCommandAlias :: String -> ReplaceCommandAlias -replaceCommandAlias = replaceText - cmdSpec :: CommandUI flags -> (flags -> [String] -> action) From e902b98fc92636fa566628e3bc6508461dea8be5 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 18 Aug 2026 12:28:00 -0400 Subject: [PATCH 082/104] Move parseCommandWithOptParse to Cmd.UI --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 15 +++++++++++++++ cabal-install/src/Distribution/Client/Main.hs | 17 +++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 23aeb1a673f..56ccb3ec842 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -24,6 +24,7 @@ module Distribution.Client.Cmd.UI , cmdSpec , cmdListOptions , commandNames + , parseCommandWithOptparse , parseCommand , replaceCommandAlias , helpDescriptionOrSynopsis @@ -228,6 +229,20 @@ parseCommand examples cmdui action replaceAlias invokedName cmdArgs = pInfo = parserInfo invokedName examples flagParsers cmdui flagParsers = cmdOptionParsers (commandOptions cmdui ParseArgs) +parseCommandWithOptparse + :: CommandUI globalFlags + -> (String -> Maybe (String -> [String] -> CommandParse action)) + -> [String] + -> Maybe (CommandParse (globalFlags, CommandParse action)) +parseCommandWithOptparse globalCommand parserForCommand argv = + case commandParseArgs globalCommand True argv of + CommandReadyToGo (mkGlobalFlags, cmdArgs0) -> do + cmdName : cmdArgs <- pure cmdArgs0 + cmdParser <- parserForCommand cmdName + let globalFlags = mkGlobalFlags (commandDefaultFlags globalCommand) + pure $ CommandReadyToGo (globalFlags, cmdParser cmdName cmdArgs) + _ -> Nothing + parserInfo :: String -> Examples -> [O.Parser (CmdItem a)] -> CommandUI flags -> ParserInfo (ParsedCommand a) parserInfo invokedName examples flagParsers cmdui = info diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index 7b02b200a16..c804a7bbe61 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -182,7 +182,11 @@ import Distribution.PackageDescription , buildable ) -import Distribution.Client.Cmd.UI (cmdSpec, commandNames) +import Distribution.Client.Cmd.UI + ( cmdSpec + , commandNames + , parseCommandWithOptparse + ) import Distribution.Client.Errors import Distribution.Compat.ResponseFile import Distribution.PackageDescription.PrettyPrint @@ -200,7 +204,6 @@ import Distribution.Simple.Command , CommandUI (..) , commandAddAction , commandFromSpec - , commandParseArgs , commandShowOptions , commandsRunWithFallback , defaultCommandFallback @@ -386,14 +389,8 @@ mainWorker args = do Nothing -> commandsRunWithFallback globalCmd commands delegateToExternal argv parseBuildOrInstallWithOptparse :: [String] -> Maybe (CommandParse (GlobalFlags, CommandParse Action)) - parseBuildOrInstallWithOptparse argv = - case commandParseArgs globalCmd True argv of - CommandReadyToGo (mkGlobalFlags, cmdArgs0) -> do - cmdName : cmdArgs <- pure cmdArgs0 - cmdParser <- parserForCommand cmdName - let globalFlags = mkGlobalFlags (commandDefaultFlags globalCmd) - return $ CommandReadyToGo (globalFlags, cmdParser cmdName cmdArgs) - _ -> Nothing + parseBuildOrInstallWithOptparse = + parseCommandWithOptparse globalCmd parserForCommand where parserForCommand name | name `elem` commandNames CmdBuild.buildCommand = Just CmdBuild.parseCommand From ca844fdbcb42dbdcaeb597e6d827dabd349cb543 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 18 Aug 2026 14:10:45 -0400 Subject: [PATCH 083/104] Remove parseCommand wrappers --- .../src/Distribution/Client/Cmd/UI.hs | 5 ++--- .../src/Distribution/Client/CmdBuild.hs | 19 ++----------------- .../src/Distribution/Client/CmdInstall.hs | 19 ++----------------- cabal-install/src/Distribution/Client/Main.hs | 7 +++++-- 4 files changed, 11 insertions(+), 39 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 56ccb3ec842..59dcc666184 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -206,11 +206,10 @@ parseCommand :: Examples -> CommandUI (NixStyleFlags a) -> (NixStyleFlags a -> [String] -> action) - -> ReplaceCommandAlias -> String -> [String] -> CommandParse action -parseCommand examples cmdui action replaceAlias invokedName cmdArgs = +parseCommand examples cmdui action invokedName cmdArgs = case execParserPure defaultPrefs pInfo cmdArgs of Success parsed -> if parsedListOptions parsed @@ -221,7 +220,7 @@ parseCommand examples cmdui action replaceAlias invokedName cmdArgs = Failure failure -> let (msg, exitCode) = renderFailure failure ("cabal " ++ invokedName) in if exitCode == ExitSuccess - then CommandHelp (helpText replaceAlias cmdui invokedName) + then CommandHelp (helpText (replaceCommandAlias (commandName cmdui)) cmdui invokedName) else CommandErrors [msg] CompletionInvoked _ -> CommandErrors ["Shell completion is not supported by this parser path."] diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index cf84847a31f..552161f86d9 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -5,12 +5,10 @@ module Distribution.Client.CmdBuild ( -- * The @build@ CLI command UI and action buildCommand , buildAction + , examples , BuildFlags (..) , defaultBuildFlags - -- * The @build@ CLI command spec and parser - , parseCommand - -- * Internals exposed for testing , selectPackageTargets , selectComponentTarget @@ -30,10 +28,6 @@ import Distribution.Client.TargetProblem ) import qualified Data.Map as Map -import Distribution.Client.Cmd.UI - ( replaceCommandAlias - ) -import qualified Distribution.Client.Cmd.UI as Cmd.UI import Distribution.Client.Errors import Distribution.Client.NixStyleOptions ( NixStyleFlags (..) @@ -49,8 +43,7 @@ import Distribution.Client.ScriptUtils ) import Distribution.Client.Setup (GlobalFlags, yesNoOpt) import Distribution.Simple.Command - ( CommandParse (..) - , CommandUI (..) + ( CommandUI (..) , option , usageAlternatives ) @@ -58,14 +51,6 @@ import Distribution.Simple.Flag (Flag, fromFlag, toFlag) import Distribution.Simple.Utils (dieWithException, wrapText) import Distribution.Verbosity (normal) -parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) -parseCommand = - Cmd.UI.parseCommand - examples - buildCommand - buildAction - (replaceCommandAlias (commandName buildCommand)) - description :: String description = "Build one or more targets from within the project. The available " diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index faf20051ece..c78c7fe85cf 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -7,9 +7,7 @@ module Distribution.Client.CmdInstall ( -- * The @install@ CLI command UI and action installCommand , installAction - - -- * The @install@ CLI command spec and parser - , parseCommand + , examples -- * Internals exposed for testing , selectPackageTargets @@ -34,10 +32,6 @@ import Distribution.Client.TargetProblem import Distribution.Client.CmdInstall.ClientInstallFlags import Distribution.Client.CmdInstall.ClientInstallTargetSelector -import Distribution.Client.Cmd.UI - ( replaceCommandAlias - ) -import qualified Distribution.Client.Cmd.UI as Cmd.UI import Distribution.Client.Config ( SavedConfig (..) , defaultInstallPath @@ -125,8 +119,7 @@ import Distribution.Simple.BuildPaths ( exeExtension ) import Distribution.Simple.Command - ( CommandParse (..) - , CommandUI (..) + ( CommandUI (..) , OptionField (..) , optionName , usageAlternatives @@ -294,14 +287,6 @@ data InstallExe = InstallExe -- store. } -parseCommand :: String -> [String] -> CommandParse (GlobalFlags -> IO ()) -parseCommand = - Cmd.UI.parseCommand - examples - installCommand - installAction - (replaceCommandAlias (commandName installCommand)) - description :: String description = "Installs one or more packages. This is done by installing them " diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index c804a7bbe61..1297c835e25 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -185,6 +185,7 @@ import Distribution.PackageDescription import Distribution.Client.Cmd.UI ( cmdSpec , commandNames + , parseCommand , parseCommandWithOptparse ) import Distribution.Client.Errors @@ -393,8 +394,10 @@ mainWorker args = do parseCommandWithOptparse globalCmd parserForCommand where parserForCommand name - | name `elem` commandNames CmdBuild.buildCommand = Just CmdBuild.parseCommand - | name `elem` commandNames CmdInstall.installCommand = Just CmdInstall.parseCommand + | name `elem` commandNames CmdBuild.buildCommand = + Just $ parseCommand CmdBuild.examples CmdBuild.buildCommand CmdBuild.buildAction + | name `elem` commandNames CmdInstall.installCommand = + Just $ parseCommand CmdInstall.examples CmdInstall.installCommand CmdInstall.installAction | otherwise = Nothing delegateToExternal From 6762611847e56418431df1162c35ce09ce8f72ef Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 18 Aug 2026 14:29:03 -0400 Subject: [PATCH 084/104] Add parseCommandWithOptparseMany --- .../src/Distribution/Client/Cmd/UI.hs | 38 +++++++++++++++++++ cabal-install/src/Distribution/Client/Main.hs | 20 +++++----- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 59dcc666184..d157f24461b 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -24,7 +24,10 @@ module Distribution.Client.Cmd.UI , cmdSpec , cmdListOptions , commandNames + , NamedCommandParser (..) + , commandParserByName , parseCommandWithOptparse + , parseCommandWithOptparseMany , parseCommand , replaceCommandAlias , helpDescriptionOrSynopsis @@ -242,6 +245,41 @@ parseCommandWithOptparse globalCommand parserForCommand argv = pure $ CommandReadyToGo (globalFlags, cmdParser cmdName cmdArgs) _ -> Nothing +-- | A parser for one or more command names. +data NamedCommandParser action = NamedCommandParser + { namedCommandNames :: [String] + -- ^ The command name and its aliases. + , namedCommandParser :: String -> [String] -> CommandParse action + } + +-- | Wrap a command's optparse parser together with the names it should match. +commandParserByName + :: Examples + -> CommandUI (NixStyleFlags flags) + -> (NixStyleFlags flags -> [String] -> action) + -> NamedCommandParser action +commandParserByName examples command action = + NamedCommandParser + { namedCommandNames = commandNames command + , namedCommandParser = \name args -> parseCommand examples command action name args + } + +-- | Parse a command using a list of name/parser associations, picking the first +-- match in the list. +parseCommandWithOptparseMany + :: CommandUI globalFlags + -> [NamedCommandParser action] + -> [String] + -> Maybe (CommandParse (globalFlags, CommandParse action)) +parseCommandWithOptparseMany globalCommand commands argv = + case commandParseArgs globalCommand True argv of + CommandReadyToGo (mkGlobalFlags, cmdArgs0) -> do + cmdName : cmdArgs <- pure cmdArgs0 + parser <- find ((cmdName `elem`) . namedCommandNames) commands + let globalFlags = mkGlobalFlags (commandDefaultFlags globalCommand) + pure $ CommandReadyToGo (globalFlags, namedCommandParser parser cmdName cmdArgs) + _ -> Nothing + parserInfo :: String -> Examples -> [O.Parser (CmdItem a)] -> CommandUI flags -> ParserInfo (ParsedCommand a) parserInfo invokedName examples flagParsers cmdui = info diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index 1297c835e25..9e5c7da2446 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -184,9 +184,8 @@ import Distribution.PackageDescription import Distribution.Client.Cmd.UI ( cmdSpec - , commandNames - , parseCommand - , parseCommandWithOptparse + , commandParserByName + , parseCommandWithOptparseMany ) import Distribution.Client.Errors import Distribution.Compat.ResponseFile @@ -383,6 +382,8 @@ mainWorker args = do warnIfAssertionsAreEnabled action globalFlags where + -- Tries to parse the command line arguments with optparse-applicative + -- first, and if that fails, falls back to the standard command registry. commandsRunBuildOptparseFirst :: [String] -> IO (CommandParse (GlobalFlags, CommandParse Action)) commandsRunBuildOptparseFirst argv = case parseBuildOrInstallWithOptparse argv of @@ -391,14 +392,11 @@ mainWorker args = do parseBuildOrInstallWithOptparse :: [String] -> Maybe (CommandParse (GlobalFlags, CommandParse Action)) parseBuildOrInstallWithOptparse = - parseCommandWithOptparse globalCmd parserForCommand - where - parserForCommand name - | name `elem` commandNames CmdBuild.buildCommand = - Just $ parseCommand CmdBuild.examples CmdBuild.buildCommand CmdBuild.buildAction - | name `elem` commandNames CmdInstall.installCommand = - Just $ parseCommand CmdInstall.examples CmdInstall.installCommand CmdInstall.installAction - | otherwise = Nothing + parseCommandWithOptparseMany + globalCmd + [ commandParserByName CmdBuild.examples CmdBuild.buildCommand CmdBuild.buildAction + , commandParserByName CmdInstall.examples CmdInstall.installCommand CmdInstall.installAction + ] delegateToExternal :: [Command Action] From 3fc9616bf55d169ab2736bffbf2a6e7753f9af48 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Tue, 18 Aug 2026 15:00:11 -0400 Subject: [PATCH 085/104] Renaming and use parseMany --- cabal-install/src/Distribution/Client/Main.hs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index 9e5c7da2446..b8b06515cee 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -350,7 +350,7 @@ warnIfAssertionsAreEnabled = mainWorker :: [String] -> IO () mainWorker args = do topHandler (isUserException (Proxy @(VerboseException CabalInstallException))) $ do - command <- commandsRunBuildOptparseFirst args + command <- commandsParse args case command of CommandHelp help -> printGlobalHelp help CommandList opts -> printOptionsList opts @@ -384,19 +384,16 @@ mainWorker args = do where -- Tries to parse the command line arguments with optparse-applicative -- first, and if that fails, falls back to the standard command registry. - commandsRunBuildOptparseFirst :: [String] -> IO (CommandParse (GlobalFlags, CommandParse Action)) - commandsRunBuildOptparseFirst argv = - case parseBuildOrInstallWithOptparse argv of + commandsParse :: [String] -> IO (CommandParse (GlobalFlags, CommandParse Action)) + commandsParse argv = + case parseCommandWithOptparseMany globalCmd parsersByName argv of Just parsed -> pure parsed Nothing -> commandsRunWithFallback globalCmd commands delegateToExternal argv - parseBuildOrInstallWithOptparse :: [String] -> Maybe (CommandParse (GlobalFlags, CommandParse Action)) - parseBuildOrInstallWithOptparse = - parseCommandWithOptparseMany - globalCmd - [ commandParserByName CmdBuild.examples CmdBuild.buildCommand CmdBuild.buildAction - , commandParserByName CmdInstall.examples CmdInstall.installCommand CmdInstall.installAction - ] + parsersByName = + [ commandParserByName CmdBuild.examples CmdBuild.buildCommand CmdBuild.buildAction + , commandParserByName CmdInstall.examples CmdInstall.installCommand CmdInstall.installAction + ] delegateToExternal :: [Command Action] From 5bc631555b63fe0cec42632890f85cf3503932a0 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 09:47:55 -0400 Subject: [PATCH 086/104] OptArg has changed upstream --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index d157f24461b..0265c9dac21 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -335,7 +335,7 @@ optDescrParser = \case (O.eitherReader (runReadE reader)) (optionMods optFlags <> O.metavar placeHolder <> O.help desc) ] - OptArg desc optFlags placeHolder reader (_defaultText, defaultFn) _show -> + OptArg desc optFlags placeHolder reader defaultFn _show -> [ Endo <$> ( O.option (O.eitherReader (runReadE reader)) @@ -370,7 +370,7 @@ optDescrToGetOpt :: OptDescr flags -> [GetOpt.OptDescr ()] optDescrToGetOpt = \case ReqArg desc (shortFlags, longFlags) placeHolder _reader _showFlag -> [GetOpt.Option shortFlags longFlags (GetOpt.ReqArg (const ()) placeHolder) desc] - OptArg desc (shortFlags, longFlags) placeHolder _reader (_defaultValue, _defaultSetter) _showFlag -> + OptArg desc (shortFlags, longFlags) placeHolder _reader _defaultFn _showFlag -> [GetOpt.Option shortFlags longFlags (GetOpt.OptArg (const ()) placeHolder) desc] ChoiceOpt choices -> [ GetOpt.Option shortFlags longFlags (GetOpt.NoArg ()) desc From 017c22e10691d654b61f932333130f77d25f950a Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 10:50:04 -0400 Subject: [PATCH 087/104] Apply edits in command line order --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 0265c9dac21..ac4933dc45b 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -298,7 +298,11 @@ parsedCommandParser flagParsers = toParsed <$> many (cmdItemParser flagParsers) targets = [t | CmdItemTarget t <- items] listOptionsSeen = any isListOptions items in ParsedCommand - { parsedFlagEdits = mconcat edits + { -- Apply edits in command-line order, first to last, so that a + -- later option overrides an earlier one and list options + -- accumulate in the order given. @Endo f <> Endo g@ applies + -- @g@ first, so the list is reversed before being combined. + parsedFlagEdits = mconcat (reverse edits) , parsedTargets = targets , parsedListOptions = listOptionsSeen } From 4c899e100302ae6f0b08016900f51665d369a9e6 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 10:58:26 -0400 Subject: [PATCH 088/104] Need default arg when not supplied --- .../src/Distribution/Client/Cmd/UI.hs | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index ac4933dc45b..20c5a016bf2 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -213,7 +213,7 @@ parseCommand -> [String] -> CommandParse action parseCommand examples cmdui action invokedName cmdArgs = - case execParserPure defaultPrefs pInfo cmdArgs of + case execParserPure defaultPrefs pInfo (supplyOptArgDefaults optionFields cmdArgs) of Success parsed -> if parsedListOptions parsed then CommandList (cmdListOptions cmdui) @@ -229,7 +229,29 @@ parseCommand examples cmdui action invokedName cmdArgs = CommandErrors ["Shell completion is not supported by this parser path."] where pInfo = parserInfo invokedName examples flagParsers cmdui - flagParsers = cmdOptionParsers (commandOptions cmdui ParseArgs) + optionFields = commandOptions cmdui ParseArgs + flagParsers = cmdOptionParsers optionFields + +-- | Insert an empty argument after each bare occurrence of an +-- optional-argument option, so that @--allow-newer@ and @-j@ keep their +-- GetOpt meaning: the option's default, with the next word left as a +-- positional argument. Attached forms such as @--allow-newer=base@ and +-- @-j4@ are left alone, as is everything after @--@. +supplyOptArgDefaults :: [OptionField flags] -> [String] -> [String] +supplyOptArgDefaults fields = go + where + go [] = [] + go ("--" : rest) = "--" : rest + go (arg : rest) + | arg `elem` bareForms = arg : "" : go rest + | otherwise = arg : go rest + + bareForms = + [ form + | OptionField _ descrs <- fields + , OptArg _ (shortFlags, longFlags) _ _ _ _ <- descrs + , form <- map (\c -> ['-', c]) shortFlags ++ map ("--" ++) longFlags + ] parseCommandWithOptparse :: CommandUI globalFlags @@ -340,13 +362,19 @@ optDescrParser = \case (optionMods optFlags <> O.metavar placeHolder <> O.help desc) ] OptArg desc optFlags placeHolder reader defaultFn _show -> + -- optparse-applicative has no optional-argument options: an option + -- either always takes an argument or never does, and a bare @-j@ would + -- swallow the next word as its value. 'supplyOptArgDefaults' gives each + -- bare occurrence an empty argument instead, which the reader maps to the + -- option's default. An explicit @--jobs=@ therefore also means the default. [ Endo - <$> ( O.option - (O.eitherReader (runReadE reader)) - (optionMods optFlags <> O.metavar placeHolder <> O.help desc) - <|> O.flag' defaultFn (flagMods optFlags <> O.internal) - ) + <$> O.option + (O.eitherReader readOrDefault) + (optionMods optFlags <> O.metavar placeHolder <> O.help desc) ] + where + readOrDefault "" = Right defaultFn + readOrDefault s = runReadE reader s ChoiceOpt choices -> [ Endo setFn <$ O.flag' () (flagMods optFlags <> O.help desc) From a7a2b619ae38f2ab8aabcab307673a9619e1e5f2 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 11:19:40 -0400 Subject: [PATCH 089/104] Update bootstrap with optparse-applicative --- bootstrap/linux-9.10.3.json | 87 +++++++++++++++++++++++++++++++++++++ bootstrap/linux-9.12.4.json | 87 +++++++++++++++++++++++++++++++++++++ bootstrap/linux-9.6.7.json | 87 +++++++++++++++++++++++++++++++++++++ bootstrap/linux-9.8.4.json | 87 +++++++++++++++++++++++++++++++++++++ 4 files changed, 348 insertions(+) diff --git a/bootstrap/linux-9.10.3.json b/bootstrap/linux-9.10.3.json index 140b38d0f40..c1c2252a97d 100644 --- a/bootstrap/linux-9.10.3.json +++ b/bootstrap/linux-9.10.3.json @@ -210,6 +210,38 @@ "src_sha256": "d2a33bc281327d8f20afee18287c2e3f923f0cd86bac40dcba120ca3d2014f9b", "version": "4000.5.0" }, + { + "cabal_sha256": "613dc8d5f6e51babe57398a742ab8d5c2964fa98b773f3bf6e6a72b7e87f1c6e", + "component": "lib:colour", + "flags": [], + "package": "colour", + "revision": 0, + "source": "hackage", + "src_sha256": "1f3b1055675abe4e3362800cc9bf7ab9b92dfdf21a1f6c82b252611270be9680", + "version": "2.3.7" + }, + { + "cabal_sha256": "1d6061eceaf35a9ed269b81177dd4c8c60403a499526f7f68fdffa4ec7842e7f", + "component": "lib:ansi-terminal-types", + "flags": [], + "package": "ansi-terminal-types", + "revision": 0, + "source": "hackage", + "src_sha256": "9fc9ce2157f1889bd99a4d22c9f1c64589590be0f797c3efe71c8fa17a11a689", + "version": "1.1.3" + }, + { + "cabal_sha256": "408d9232e5304efead718f96138d6d7eb2da608c6121c5c0dc6a71a833b14320", + "component": "lib:ansi-terminal", + "flags": [ + "-example" + ], + "package": "ansi-terminal", + "revision": 0, + "source": "hackage", + "src_sha256": "9cf083cef2e2ba88a425f132c8a82bfa931eb4b0c38232b2017f8fcea2e23073", + "version": "1.1.5" + }, { "cabal_sha256": "140fc5adad166f7b527567cbd26ff481e8da4a66bdfc84be3ddf28dbeb66f275", "component": "lib:hashable", @@ -459,6 +491,61 @@ "src_sha256": "1066e286615e39ef43f7e7437a4644775246e264c33b4d259b4858cff0985f0b", "version": "0.5.1.0" }, + { + "cabal_sha256": "e3a802ea939d465b2e37b9fa09d8e5bb88b5775d6d62dd2ec6ca32b63416656d", + "component": "lib:prettyprinter", + "flags": [ + "-buildreadme", + "+text" + ], + "package": "prettyprinter", + "revision": 0, + "source": "hackage", + "src_sha256": "f04eb6fd865512ad8672da1e8bfcea1c384509fc2f662c41b7ac39d7898706ee", + "version": "1.7.2" + }, + { + "cabal_sha256": "5184ba6002a650de3307547347eaba19bdc9b82eb68e943f406818caa215ce4f", + "component": "lib:prettyprinter-ansi-terminal", + "flags": [ + "+text" + ], + "package": "prettyprinter-ansi-terminal", + "revision": 0, + "source": "hackage", + "src_sha256": "912cd340d5c2583111e2eaeb9aa03b87551ca2e3dd78bbfd346756b9f1e6c9fe", + "version": "1.1.4" + }, + { + "cabal_sha256": "044fb9955f63ee138fcebedfdcbe54afe741f2d5892a2d0bdf3a8052bd342643", + "component": "lib:transformers-compat", + "flags": [ + "-five", + "+five-three", + "-four", + "+generic-deriving", + "+mtl", + "-three", + "-two" + ], + "package": "transformers-compat", + "revision": 0, + "source": "hackage", + "src_sha256": "b62c7304c9f3cbc9463d0739aa85cb9489f217ea092b9d625d417514fbcc9d6a", + "version": "0.7.2" + }, + { + "cabal_sha256": "f30973861ac7e7ebff05ff8c7c3d1e4d283a1f3850e1cc14106b0693ec1b6d82", + "component": "lib:optparse-applicative", + "flags": [ + "+process" + ], + "package": "optparse-applicative", + "revision": 1, + "source": "hackage", + "src_sha256": "63811ab4fd26e829b8868364325a88be3acc79819f5bb5005b2dd3b961ecc491", + "version": "0.18.1.0" + }, { "cabal_sha256": "d6c0c6d1136f5046207a331114ff4130e70640452096de7719bf03e3fceb7c7b", "component": "lib:regex-base", diff --git a/bootstrap/linux-9.12.4.json b/bootstrap/linux-9.12.4.json index 2b2203ec259..8fd343f5f94 100644 --- a/bootstrap/linux-9.12.4.json +++ b/bootstrap/linux-9.12.4.json @@ -214,6 +214,38 @@ "src_sha256": "d2a33bc281327d8f20afee18287c2e3f923f0cd86bac40dcba120ca3d2014f9b", "version": "4000.5.0" }, + { + "cabal_sha256": "613dc8d5f6e51babe57398a742ab8d5c2964fa98b773f3bf6e6a72b7e87f1c6e", + "component": "lib:colour", + "flags": [], + "package": "colour", + "revision": 0, + "source": "hackage", + "src_sha256": "1f3b1055675abe4e3362800cc9bf7ab9b92dfdf21a1f6c82b252611270be9680", + "version": "2.3.7" + }, + { + "cabal_sha256": "1d6061eceaf35a9ed269b81177dd4c8c60403a499526f7f68fdffa4ec7842e7f", + "component": "lib:ansi-terminal-types", + "flags": [], + "package": "ansi-terminal-types", + "revision": 0, + "source": "hackage", + "src_sha256": "9fc9ce2157f1889bd99a4d22c9f1c64589590be0f797c3efe71c8fa17a11a689", + "version": "1.1.3" + }, + { + "cabal_sha256": "408d9232e5304efead718f96138d6d7eb2da608c6121c5c0dc6a71a833b14320", + "component": "lib:ansi-terminal", + "flags": [ + "-example" + ], + "package": "ansi-terminal", + "revision": 0, + "source": "hackage", + "src_sha256": "9cf083cef2e2ba88a425f132c8a82bfa931eb4b0c38232b2017f8fcea2e23073", + "version": "1.1.5" + }, { "cabal_sha256": "140fc5adad166f7b527567cbd26ff481e8da4a66bdfc84be3ddf28dbeb66f275", "component": "lib:hashable", @@ -450,6 +482,61 @@ "src_sha256": "1066e286615e39ef43f7e7437a4644775246e264c33b4d259b4858cff0985f0b", "version": "0.5.1.0" }, + { + "cabal_sha256": "e3a802ea939d465b2e37b9fa09d8e5bb88b5775d6d62dd2ec6ca32b63416656d", + "component": "lib:prettyprinter", + "flags": [ + "-buildreadme", + "+text" + ], + "package": "prettyprinter", + "revision": 0, + "source": "hackage", + "src_sha256": "f04eb6fd865512ad8672da1e8bfcea1c384509fc2f662c41b7ac39d7898706ee", + "version": "1.7.2" + }, + { + "cabal_sha256": "5184ba6002a650de3307547347eaba19bdc9b82eb68e943f406818caa215ce4f", + "component": "lib:prettyprinter-ansi-terminal", + "flags": [ + "+text" + ], + "package": "prettyprinter-ansi-terminal", + "revision": 0, + "source": "hackage", + "src_sha256": "912cd340d5c2583111e2eaeb9aa03b87551ca2e3dd78bbfd346756b9f1e6c9fe", + "version": "1.1.4" + }, + { + "cabal_sha256": "044fb9955f63ee138fcebedfdcbe54afe741f2d5892a2d0bdf3a8052bd342643", + "component": "lib:transformers-compat", + "flags": [ + "-five", + "+five-three", + "-four", + "+generic-deriving", + "+mtl", + "-three", + "-two" + ], + "package": "transformers-compat", + "revision": 0, + "source": "hackage", + "src_sha256": "b62c7304c9f3cbc9463d0739aa85cb9489f217ea092b9d625d417514fbcc9d6a", + "version": "0.7.2" + }, + { + "cabal_sha256": "f30973861ac7e7ebff05ff8c7c3d1e4d283a1f3850e1cc14106b0693ec1b6d82", + "component": "lib:optparse-applicative", + "flags": [ + "+process" + ], + "package": "optparse-applicative", + "revision": 1, + "source": "hackage", + "src_sha256": "63811ab4fd26e829b8868364325a88be3acc79819f5bb5005b2dd3b961ecc491", + "version": "0.18.1.0" + }, { "cabal_sha256": "d6c0c6d1136f5046207a331114ff4130e70640452096de7719bf03e3fceb7c7b", "component": "lib:regex-base", diff --git a/bootstrap/linux-9.6.7.json b/bootstrap/linux-9.6.7.json index 842d5572401..bd9320e9429 100644 --- a/bootstrap/linux-9.6.7.json +++ b/bootstrap/linux-9.6.7.json @@ -202,6 +202,38 @@ "src_sha256": "d2a33bc281327d8f20afee18287c2e3f923f0cd86bac40dcba120ca3d2014f9b", "version": "4000.5.0" }, + { + "cabal_sha256": "613dc8d5f6e51babe57398a742ab8d5c2964fa98b773f3bf6e6a72b7e87f1c6e", + "component": "lib:colour", + "flags": [], + "package": "colour", + "revision": 0, + "source": "hackage", + "src_sha256": "1f3b1055675abe4e3362800cc9bf7ab9b92dfdf21a1f6c82b252611270be9680", + "version": "2.3.7" + }, + { + "cabal_sha256": "1d6061eceaf35a9ed269b81177dd4c8c60403a499526f7f68fdffa4ec7842e7f", + "component": "lib:ansi-terminal-types", + "flags": [], + "package": "ansi-terminal-types", + "revision": 0, + "source": "hackage", + "src_sha256": "9fc9ce2157f1889bd99a4d22c9f1c64589590be0f797c3efe71c8fa17a11a689", + "version": "1.1.3" + }, + { + "cabal_sha256": "408d9232e5304efead718f96138d6d7eb2da608c6121c5c0dc6a71a833b14320", + "component": "lib:ansi-terminal", + "flags": [ + "-example" + ], + "package": "ansi-terminal", + "revision": 0, + "source": "hackage", + "src_sha256": "9cf083cef2e2ba88a425f132c8a82bfa931eb4b0c38232b2017f8fcea2e23073", + "version": "1.1.5" + }, { "cabal_sha256": "c0663f5f428108680f4aae0f67b7b357c1bb5954281c7fbe941c50c58cd79f18", "component": "lib:os-string", @@ -461,6 +493,61 @@ "src_sha256": "1066e286615e39ef43f7e7437a4644775246e264c33b4d259b4858cff0985f0b", "version": "0.5.1.0" }, + { + "cabal_sha256": "e3a802ea939d465b2e37b9fa09d8e5bb88b5775d6d62dd2ec6ca32b63416656d", + "component": "lib:prettyprinter", + "flags": [ + "-buildreadme", + "+text" + ], + "package": "prettyprinter", + "revision": 0, + "source": "hackage", + "src_sha256": "f04eb6fd865512ad8672da1e8bfcea1c384509fc2f662c41b7ac39d7898706ee", + "version": "1.7.2" + }, + { + "cabal_sha256": "5184ba6002a650de3307547347eaba19bdc9b82eb68e943f406818caa215ce4f", + "component": "lib:prettyprinter-ansi-terminal", + "flags": [ + "+text" + ], + "package": "prettyprinter-ansi-terminal", + "revision": 0, + "source": "hackage", + "src_sha256": "912cd340d5c2583111e2eaeb9aa03b87551ca2e3dd78bbfd346756b9f1e6c9fe", + "version": "1.1.4" + }, + { + "cabal_sha256": "044fb9955f63ee138fcebedfdcbe54afe741f2d5892a2d0bdf3a8052bd342643", + "component": "lib:transformers-compat", + "flags": [ + "-five", + "+five-three", + "-four", + "+generic-deriving", + "+mtl", + "-three", + "-two" + ], + "package": "transformers-compat", + "revision": 0, + "source": "hackage", + "src_sha256": "b62c7304c9f3cbc9463d0739aa85cb9489f217ea092b9d625d417514fbcc9d6a", + "version": "0.7.2" + }, + { + "cabal_sha256": "f30973861ac7e7ebff05ff8c7c3d1e4d283a1f3850e1cc14106b0693ec1b6d82", + "component": "lib:optparse-applicative", + "flags": [ + "+process" + ], + "package": "optparse-applicative", + "revision": 1, + "source": "hackage", + "src_sha256": "63811ab4fd26e829b8868364325a88be3acc79819f5bb5005b2dd3b961ecc491", + "version": "0.18.1.0" + }, { "cabal_sha256": "d6c0c6d1136f5046207a331114ff4130e70640452096de7719bf03e3fceb7c7b", "component": "lib:regex-base", diff --git a/bootstrap/linux-9.8.4.json b/bootstrap/linux-9.8.4.json index 56be7837098..569e9ac11b7 100644 --- a/bootstrap/linux-9.8.4.json +++ b/bootstrap/linux-9.8.4.json @@ -202,6 +202,38 @@ "src_sha256": "d2a33bc281327d8f20afee18287c2e3f923f0cd86bac40dcba120ca3d2014f9b", "version": "4000.5.0" }, + { + "cabal_sha256": "613dc8d5f6e51babe57398a742ab8d5c2964fa98b773f3bf6e6a72b7e87f1c6e", + "component": "lib:colour", + "flags": [], + "package": "colour", + "revision": 0, + "source": "hackage", + "src_sha256": "1f3b1055675abe4e3362800cc9bf7ab9b92dfdf21a1f6c82b252611270be9680", + "version": "2.3.7" + }, + { + "cabal_sha256": "1d6061eceaf35a9ed269b81177dd4c8c60403a499526f7f68fdffa4ec7842e7f", + "component": "lib:ansi-terminal-types", + "flags": [], + "package": "ansi-terminal-types", + "revision": 0, + "source": "hackage", + "src_sha256": "9fc9ce2157f1889bd99a4d22c9f1c64589590be0f797c3efe71c8fa17a11a689", + "version": "1.1.3" + }, + { + "cabal_sha256": "408d9232e5304efead718f96138d6d7eb2da608c6121c5c0dc6a71a833b14320", + "component": "lib:ansi-terminal", + "flags": [ + "-example" + ], + "package": "ansi-terminal", + "revision": 0, + "source": "hackage", + "src_sha256": "9cf083cef2e2ba88a425f132c8a82bfa931eb4b0c38232b2017f8fcea2e23073", + "version": "1.1.5" + }, { "cabal_sha256": "c0663f5f428108680f4aae0f67b7b357c1bb5954281c7fbe941c50c58cd79f18", "component": "lib:os-string", @@ -461,6 +493,61 @@ "src_sha256": "1066e286615e39ef43f7e7437a4644775246e264c33b4d259b4858cff0985f0b", "version": "0.5.1.0" }, + { + "cabal_sha256": "e3a802ea939d465b2e37b9fa09d8e5bb88b5775d6d62dd2ec6ca32b63416656d", + "component": "lib:prettyprinter", + "flags": [ + "-buildreadme", + "+text" + ], + "package": "prettyprinter", + "revision": 0, + "source": "hackage", + "src_sha256": "f04eb6fd865512ad8672da1e8bfcea1c384509fc2f662c41b7ac39d7898706ee", + "version": "1.7.2" + }, + { + "cabal_sha256": "5184ba6002a650de3307547347eaba19bdc9b82eb68e943f406818caa215ce4f", + "component": "lib:prettyprinter-ansi-terminal", + "flags": [ + "+text" + ], + "package": "prettyprinter-ansi-terminal", + "revision": 0, + "source": "hackage", + "src_sha256": "912cd340d5c2583111e2eaeb9aa03b87551ca2e3dd78bbfd346756b9f1e6c9fe", + "version": "1.1.4" + }, + { + "cabal_sha256": "044fb9955f63ee138fcebedfdcbe54afe741f2d5892a2d0bdf3a8052bd342643", + "component": "lib:transformers-compat", + "flags": [ + "-five", + "+five-three", + "-four", + "+generic-deriving", + "+mtl", + "-three", + "-two" + ], + "package": "transformers-compat", + "revision": 0, + "source": "hackage", + "src_sha256": "b62c7304c9f3cbc9463d0739aa85cb9489f217ea092b9d625d417514fbcc9d6a", + "version": "0.7.2" + }, + { + "cabal_sha256": "f30973861ac7e7ebff05ff8c7c3d1e4d283a1f3850e1cc14106b0693ec1b6d82", + "component": "lib:optparse-applicative", + "flags": [ + "+process" + ], + "package": "optparse-applicative", + "revision": 1, + "source": "hackage", + "src_sha256": "63811ab4fd26e829b8868364325a88be3acc79819f5bb5005b2dd3b961ecc491", + "version": "0.18.1.0" + }, { "cabal_sha256": "d6c0c6d1136f5046207a331114ff4130e70640452096de7719bf03e3fceb7c7b", "component": "lib:regex-base", From 98342ab0b0e873777dc8f982eec0c5a7d57ad1c8 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 11:38:25 -0400 Subject: [PATCH 090/104] Strip ANSII color codes --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 10 ++++++++++ cabal-install/src/Distribution/Client/Main.hs | 12 ++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 20c5a016bf2..ba9dbc8e1d8 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -39,6 +39,7 @@ module Distribution.Client.Cmd.UI , wrapDescription , capitalizeDescription , helpText + , stripAnsiCodes -- * Option grouping helpers , groupPredicates @@ -727,6 +728,15 @@ renderInstallLayoutGroupCompact helpOutputWidth options = colorizeHeader :: String -> String colorizeHeader text = "\ESC[32m" <> text <> "\ESC[0m" +-- | Remove the ANSI colour codes added by the @colorize*@ functions, for +-- output that is not going to a terminal. +stripAnsiCodes :: String -> String +stripAnsiCodes = go + where + go [] = [] + go ('\ESC' : '[' : rest) = go (drop 1 (dropWhile (/= 'm') rest)) + go (c : rest) = c : go rest + colorizeWarningHeader :: String -> String colorizeWarningHeader text = "\ESC[31m" <> text <> "\ESC[0m" diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index b8b06515cee..8260bb9c604 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -186,6 +186,7 @@ import Distribution.Client.Cmd.UI ( cmdSpec , commandParserByName , parseCommandWithOptparseMany + , stripAnsiCodes ) import Distribution.Client.Errors import Distribution.Compat.ResponseFile @@ -276,7 +277,7 @@ import System.Directory ( doesFileExist , withCurrentDirectory ) -import System.Environment (getEnvironment, getExecutablePath, getProgName) +import System.Environment (getEnvironment, getExecutablePath, getProgName, lookupEnv) import System.FilePath ( dropExtension , splitExtension @@ -286,6 +287,7 @@ import System.FilePath ) import System.IO ( BufferMode (LineBuffering) + , hIsTerminalDevice , hPutStrLn , hSetBuffering , stderr @@ -422,7 +424,13 @@ mainWorker args = do printCommandHelp help = do pname <- getProgName - putStr (help pname) + -- The command help may contain colour codes. Keep them only when writing + -- to a terminal and the user has not opted out with NO_COLOR, so that + -- redirected output such as the generated docs stays plain text. + isTerminal <- hIsTerminalDevice stdout + noColor <- lookupEnv "NO_COLOR" + let useColor = isTerminal && maybe True null noColor + putStr $ if useColor then help pname else stripAnsiCodes (help pname) printGlobalHelp help = do pname <- getProgName configFile <- defaultConfigFile From 6bdba464d2c606c7848cc9f3e63806dcc00605e6 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 11:46:31 -0400 Subject: [PATCH 091/104] Add HelpColor --- .../src/Distribution/Client/Cmd/UI.hs | 80 ++++++++++--------- cabal-install/src/Distribution/Client/Main.hs | 32 ++++---- 2 files changed, 59 insertions(+), 53 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index ba9dbc8e1d8..09ecebb8019 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -39,7 +39,7 @@ module Distribution.Client.Cmd.UI , wrapDescription , capitalizeDescription , helpText - , stripAnsiCodes + , HelpColor (..) -- * Option grouping helpers , groupPredicates @@ -207,13 +207,14 @@ cmdListOptions command = _ -> [] parseCommand - :: Examples + :: HelpColor + -> Examples -> CommandUI (NixStyleFlags a) -> (NixStyleFlags a -> [String] -> action) -> String -> [String] -> CommandParse action -parseCommand examples cmdui action invokedName cmdArgs = +parseCommand helpColor examples cmdui action invokedName cmdArgs = case execParserPure defaultPrefs pInfo (supplyOptArgDefaults optionFields cmdArgs) of Success parsed -> if parsedListOptions parsed @@ -224,7 +225,7 @@ parseCommand examples cmdui action invokedName cmdArgs = Failure failure -> let (msg, exitCode) = renderFailure failure ("cabal " ++ invokedName) in if exitCode == ExitSuccess - then CommandHelp (helpText (replaceCommandAlias (commandName cmdui)) cmdui invokedName) + then CommandHelp (helpText helpColor (replaceCommandAlias (commandName cmdui)) cmdui invokedName) else CommandErrors [msg] CompletionInvoked _ -> CommandErrors ["Shell completion is not supported by this parser path."] @@ -277,14 +278,15 @@ data NamedCommandParser action = NamedCommandParser -- | Wrap a command's optparse parser together with the names it should match. commandParserByName - :: Examples + :: HelpColor + -> Examples -> CommandUI (NixStyleFlags flags) -> (NixStyleFlags flags -> [String] -> action) -> NamedCommandParser action -commandParserByName examples command action = +commandParserByName helpColor examples command action = NamedCommandParser { namedCommandNames = commandNames command - , namedCommandParser = \name args -> parseCommand examples command action name args + , namedCommandParser = \name args -> parseCommand helpColor examples command action name args } -- | Parse a command using a list of name/parser associations, picking the first @@ -622,19 +624,19 @@ groupPredicates = , (ProgramOverrideOptions, keepProgOptions) ] -helpText :: ReplaceCommandAlias -> CommandUI (NixStyleFlags a) -> String -> String -> String -helpText replaceBuildAlias buildCommand invokedName pname = +helpText :: HelpColor -> ReplaceCommandAlias -> CommandUI (NixStyleFlags a) -> String -> String -> String +helpText helpColor replaceBuildAlias buildCommand invokedName pname = commandSynopsis buildCommand <> "\n\n" - <> colorizeUsageHeader (replaceBuildAlias invokedName (commandUsage buildCommand pname)) + <> colorizeUsageHeader helpColor (replaceBuildAlias invokedName (commandUsage buildCommand pname)) <> maybe "" (('\n' :) . ($ pname)) (commandDescription buildCommand) <> "\n" - <> colorizeHeader "Flags for build:" + <> colorizeHeader helpColor "Flags for build:" <> "\n" <> ungroupedRows <> groupedRows <> warningSection - <> maybe "" (('\n' :) . colorizeExamplesHeader . replaceBuildAlias invokedName . ($ pname)) (commandNotes buildCommand) + <> maybe "" (('\n' :) . colorizeExamplesHeader helpColor . replaceBuildAlias invokedName . ($ pname)) (commandNotes buildCommand) where commonHelpOptions :: [GetOpt.OptDescr ()] commonHelpOptions = @@ -667,13 +669,13 @@ helpText replaceBuildAlias buildCommand invokedName pname = (ungroupedRows, ungroupedWarnings) = renderOptionRows - colorizeWarningHeader + (colorizeWarningHeader helpColor) maxFlagColumnWidth descColumn helpOutputWidth (commonHelpOptions ++ concatMap optionFieldToGetOpt optsUngrouped) - renderGroupToWidth = renderGroup maxFlagColumnWidth descColumn helpOutputWidth + renderGroupToWidth = renderGroup helpColor maxFlagColumnWidth descColumn helpOutputWidth renderedGroups = map renderGroupToWidth optsGrouped groupedRows = concatMap fst renderedGroups @@ -685,36 +687,36 @@ helpText replaceBuildAlias buildCommand invokedName pname = [] -> "" warnings -> "\n" - <> colorizeWarningHeader "Warnings:" + <> colorizeWarningHeader helpColor "Warnings:" <> "\n" <> concat [" - " <> warning <> "\n" | warning <- warnings] (optsGrouped, optsUngrouped) = groupSequentially (commandOptions buildCommand ShowArgs) groupPredicates -renderGroup :: Int -> Int -> Int -> (OptionGroupKey, [OptionField a]) -> (String, [String]) -renderGroup maxFlagColumnWidth descColumn helpOutputWidth (title, options) +renderGroup :: HelpColor -> Int -> Int -> Int -> (OptionGroupKey, [OptionField a]) -> (String, [String]) +renderGroup helpColor maxFlagColumnWidth descColumn helpOutputWidth (title, options) | null options = ("", []) - | title == InstallLayoutOptions = renderInstallLayoutGroupCompact helpOutputWidth options + | title == InstallLayoutOptions = renderInstallLayoutGroupCompact helpColor helpOutputWidth options | otherwise = let (rows, warnings) = renderOptionRows - colorizeWarningHeader + (colorizeWarningHeader helpColor) maxFlagColumnWidth descColumn helpOutputWidth (concatMap optionFieldToGetOpt options) in ( "\n" - <> colorizeHeader (show title <> ":") + <> colorizeHeader helpColor (show title <> ":") <> "\n" <> rows , warnings ) -renderInstallLayoutGroupCompact :: Int -> [OptionField a] -> (String, [String]) -renderInstallLayoutGroupCompact helpOutputWidth options = +renderInstallLayoutGroupCompact :: HelpColor -> Int -> [OptionField a] -> (String, [String]) +renderInstallLayoutGroupCompact helpColor helpOutputWidth options = ( "\n" - <> colorizeHeader (show InstallLayoutOptions <> ":") + <> colorizeHeader helpColor (show InstallLayoutOptions <> ":") <> "\n" <> concat [" " <> line <> "\n" | line <- wrappedFlagLines] , [] @@ -725,23 +727,23 @@ renderInstallLayoutGroupCompact helpOutputWidth options = flagsLine = intercalate ", " compactFlags wrappedFlagLines = wrapDescription (max 40 (helpOutputWidth - 2)) flagsLine -colorizeHeader :: String -> String -colorizeHeader text = "\ESC[32m" <> text <> "\ESC[0m" +-- | Whether command help is rendered with ANSI colour codes. Colour is for +-- terminals only; redirected output such as the generated docs is plain text. +data HelpColor = HelpColor | HelpPlain + deriving (Eq, Show) --- | Remove the ANSI colour codes added by the @colorize*@ functions, for --- output that is not going to a terminal. -stripAnsiCodes :: String -> String -stripAnsiCodes = go - where - go [] = [] - go ('\ESC' : '[' : rest) = go (drop 1 (dropWhile (/= 'm') rest)) - go (c : rest) = c : go rest +colorize :: HelpColor -> String -> String -> String +colorize HelpPlain _ text = text +colorize HelpColor code text = "\ESC[" <> code <> "m" <> text <> "\ESC[0m" + +colorizeHeader :: HelpColor -> String -> String +colorizeHeader helpColor = colorize helpColor "32" -colorizeWarningHeader :: String -> String -colorizeWarningHeader text = "\ESC[31m" <> text <> "\ESC[0m" +colorizeWarningHeader :: HelpColor -> String -> String +colorizeWarningHeader helpColor = colorize helpColor "31" -colorizeUsageHeader :: String -> String -colorizeUsageHeader = T.unpack . T.replace (T.pack "Usage:") (T.pack $ colorizeHeader "Usage:") . T.pack +colorizeUsageHeader :: HelpColor -> String -> String +colorizeUsageHeader helpColor = T.unpack . T.replace (T.pack "Usage:") (T.pack $ colorizeHeader helpColor "Usage:") . T.pack -colorizeExamplesHeader :: String -> String -colorizeExamplesHeader = T.unpack . T.replace (T.pack "Examples:") (T.pack $ colorizeHeader "Examples:") . T.pack +colorizeExamplesHeader :: HelpColor -> String -> String +colorizeExamplesHeader helpColor = T.unpack . T.replace (T.pack "Examples:") (T.pack $ colorizeHeader helpColor "Examples:") . T.pack diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index 8260bb9c604..3d9fe006c74 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -183,10 +183,10 @@ import Distribution.PackageDescription ) import Distribution.Client.Cmd.UI - ( cmdSpec + ( HelpColor (..) + , cmdSpec , commandParserByName , parseCommandWithOptparseMany - , stripAnsiCodes ) import Distribution.Client.Errors import Distribution.Compat.ResponseFile @@ -387,16 +387,26 @@ mainWorker args = do -- Tries to parse the command line arguments with optparse-applicative -- first, and if that fails, falls back to the standard command registry. commandsParse :: [String] -> IO (CommandParse (GlobalFlags, CommandParse Action)) - commandsParse argv = - case parseCommandWithOptparseMany globalCmd parsersByName argv of + commandsParse argv = do + helpColor <- helpColorMode + case parseCommandWithOptparseMany globalCmd (parsersByName helpColor) argv of Just parsed -> pure parsed Nothing -> commandsRunWithFallback globalCmd commands delegateToExternal argv - parsersByName = - [ commandParserByName CmdBuild.examples CmdBuild.buildCommand CmdBuild.buildAction - , commandParserByName CmdInstall.examples CmdInstall.installCommand CmdInstall.installAction + parsersByName helpColor = + [ commandParserByName helpColor CmdBuild.examples CmdBuild.buildCommand CmdBuild.buildAction + , commandParserByName helpColor CmdInstall.examples CmdInstall.installCommand CmdInstall.installAction ] + -- Colour the command help only when writing to a terminal and the user + -- has not opted out with NO_COLOR, so that redirected output such as the + -- generated docs stays plain text. + helpColorMode :: IO HelpColor + helpColorMode = do + isTerminal <- hIsTerminalDevice stdout + noColor <- lookupEnv "NO_COLOR" + pure $ if isTerminal && maybe True null noColor then HelpColor else HelpPlain + delegateToExternal :: [Command Action] -> String @@ -424,13 +434,7 @@ mainWorker args = do printCommandHelp help = do pname <- getProgName - -- The command help may contain colour codes. Keep them only when writing - -- to a terminal and the user has not opted out with NO_COLOR, so that - -- redirected output such as the generated docs stays plain text. - isTerminal <- hIsTerminalDevice stdout - noColor <- lookupEnv "NO_COLOR" - let useColor = isTerminal && maybe True null noColor - putStr $ if useColor then help pname else stripAnsiCodes (help pname) + putStr (help pname) printGlobalHelp help = do pname <- getProgName configFile <- defaultConfigFile From 5e14edaca75a550910df25af810ebaf2359fbcee Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 11:53:36 -0400 Subject: [PATCH 092/104] Replace bullet marker with ASCII # --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 09ecebb8019..e7039c5154a 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -439,7 +439,7 @@ renderOptionRows colorizeWarning maxFlagColumnWidth descColumn helpOutputWidth o let rendered = [renderOption (index == 0) opt | (index, opt) <- zip [0 :: Int ..] options] in (concatMap fst rendered, concatMap snd rendered) where - descriptionMarker = "• " + descriptionMarker = "# " markerPadding = replicate (length descriptionMarker) ' ' descriptionIndent = replicate (2 + descColumn) ' ' descriptionWidth = max 20 (helpOutputWidth - (2 + descColumn) - length descriptionMarker) From b7c648dae77c1cbec1ac3cb4379ff2add025882b Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 11:59:59 -0400 Subject: [PATCH 093/104] Add flag indent --- .../src/Distribution/Client/Cmd/UI.hs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index e7039c5154a..3b7bd02dd31 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -441,8 +441,8 @@ renderOptionRows colorizeWarning maxFlagColumnWidth descColumn helpOutputWidth o where descriptionMarker = "# " markerPadding = replicate (length descriptionMarker) ' ' - descriptionIndent = replicate (2 + descColumn) ' ' - descriptionWidth = max 20 (helpOutputWidth - (2 + descColumn) - length descriptionMarker) + descriptionIndent = replicate (length flagIndent + descColumn) ' ' + descriptionWidth = max 20 (helpOutputWidth - (length flagIndent + descColumn) - length descriptionMarker) renderOption isFirstInGroup opt = let (flagColumn, description) = getOptToColumns opt @@ -482,17 +482,17 @@ renderOptionRows colorizeWarning maxFlagColumnWidth descColumn helpOutputWidth o renderInline flagColumn descriptionLines = let padding = max 1 (descColumn - length flagColumn) in case descriptionLines of - [] -> " " <> flagColumn <> "\n" + [] -> flagIndent <> flagColumn <> "\n" firstLineText : continuation -> - let firstLine = " " <> flagColumn <> replicate padding ' ' <> descriptionMarker <> firstLineText <> "\n" + let firstLine = flagIndent <> flagColumn <> replicate padding ' ' <> descriptionMarker <> firstLineText <> "\n" continuationLines = [descriptionIndent <> markerPadding <> line <> "\n" | line <- continuation] in firstLine <> concat continuationLines renderStacked flagColumn descriptionLines = case descriptionLines of - [] -> " " <> flagColumn <> "\n" + [] -> flagIndent <> flagColumn <> "\n" firstLineText : continuation -> - " " + flagIndent <> flagColumn <> "\n" <> descriptionIndent @@ -718,7 +718,7 @@ renderInstallLayoutGroupCompact helpColor helpOutputWidth options = ( "\n" <> colorizeHeader helpColor (show InstallLayoutOptions <> ":") <> "\n" - <> concat [" " <> line <> "\n" | line <- wrappedFlagLines] + <> concat [flagIndent <> line <> "\n" | line <- wrappedFlagLines] , [] ) where @@ -727,6 +727,10 @@ renderInstallLayoutGroupCompact helpColor helpOutputWidth options = flagsLine = intercalate ", " compactFlags wrappedFlagLines = wrapDescription (max 40 (helpOutputWidth - 2)) flagsLine +-- | Leading indent of each flag row. +flagIndent :: String +flagIndent = " " + -- | Whether command help is rendered with ANSI colour codes. Colour is for -- terminals only; redirected output such as the generated docs is plain text. data HelpColor = HelpColor | HelpPlain From 2e4254a3a02af3f0bee0a78a8a9ca6908aa72fec Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 12:11:07 -0400 Subject: [PATCH 094/104] Mimic GetOpt layout of flags and description --- .../src/Distribution/Client/Cmd/UI.hs | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 3b7bd02dd31..433272b1abb 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -642,30 +642,21 @@ helpText helpColor replaceBuildAlias buildCommand invokedName pname = commonHelpOptions = [GetOpt.Option ['h'] ["help"] (GetOpt.NoArg ()) "Show this help text"] + -- Match the column layout of 'Distribution.GetOpt.usageInfo', which the + -- other commands still use: after the one-space indent, flags are padded + -- to 28 columns so the description marker lands in column 30, and flags + -- wider than that are stacked above their description. maxFlagColumnWidth :: Int - maxFlagColumnWidth = 30 - - helpOutputWidth :: Int - helpOutputWidth = 100 - - allOptions :: [GetOpt.OptDescr ()] - allOptions = - commonHelpOptions - ++ concatMap optionFieldToGetOpt optsUngrouped - ++ concatMap (concatMap optionFieldToGetOpt . snd) optsGrouped + maxFlagColumnWidth = 28 descColumn :: Int - descColumn = - min - maxFlagColumnWidth - ( maximum - ( 0 - : map - (length . fst . getOptToColumns) - allOptions - ) - ) - + 2 + descColumn = maxFlagColumnWidth + 1 + + -- The legacy layout wraps descriptions to stay strictly under 47 + -- columns, so its lines reach column 78 at most; wrapping at 78 here + -- reproduces the same line breaks. + helpOutputWidth :: Int + helpOutputWidth = 78 (ungroupedRows, ungroupedWarnings) = renderOptionRows From 9ce3319efdec05ff823d28067ac3042a8dd00112 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 12:15:24 -0400 Subject: [PATCH 095/104] Don't hard code "Flags for build:" --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 433272b1abb..117a413489e 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -631,7 +631,7 @@ helpText helpColor replaceBuildAlias buildCommand invokedName pname = <> colorizeUsageHeader helpColor (replaceBuildAlias invokedName (commandUsage buildCommand pname)) <> maybe "" (('\n' :) . ($ pname)) (commandDescription buildCommand) <> "\n" - <> colorizeHeader helpColor "Flags for build:" + <> colorizeHeader helpColor ("Flags for " <> replaceBuildAlias invokedName (commandName buildCommand) <> ":") <> "\n" <> ungroupedRows <> groupedRows From 0b01aaf356157cbf77c06d715d62f974aa171d51 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 12:18:58 -0400 Subject: [PATCH 096/104] Match indentation of examples --- .../src/Distribution/Client/CmdBuild.hs | 20 +++++++++---------- .../src/Distribution/Client/CmdInstall.hs | 12 +++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cabal-install/src/Distribution/Client/CmdBuild.hs b/cabal-install/src/Distribution/Client/CmdBuild.hs index 552161f86d9..0d7ad3f607b 100644 --- a/cabal-install/src/Distribution/Client/CmdBuild.hs +++ b/cabal-install/src/Distribution/Client/CmdBuild.hs @@ -68,16 +68,16 @@ examples :: String -> String -> String examples pname invokedName = unlines [ "Examples:" - , " - " <> pname <> " " <> invokedName - , " Build the package in the current directory or all packages in the project" - , " - " <> pname <> " " <> invokedName <> " pkgname" - , " Build the package named pkgname in the project" - , " - " <> pname <> " " <> invokedName <> " ./pkgfoo" - , " Build the package in the ./pkgfoo directory" - , " - " <> pname <> " " <> invokedName <> " cname" - , " Build the component named cname in the project" - , " - " <> pname <> " " <> invokedName <> " cname --enable-profiling" - , " Build the component in profiling mode (including dependencies as needed)" + , "- " <> pname <> " " <> invokedName + , " Build the package in the current directory or all packages in the project" + , "- " <> pname <> " " <> invokedName <> " pkgname" + , " Build the package named pkgname in the project" + , "- " <> pname <> " " <> invokedName <> " ./pkgfoo" + , " Build the package in the ./pkgfoo directory" + , "- " <> pname <> " " <> invokedName <> " cname" + , " Build the component named cname in the project" + , "- " <> pname <> " " <> invokedName <> " cname --enable-profiling" + , " Build the component in profiling mode (including dependencies as needed)" ] buildCommand :: CommandUI (NixStyleFlags BuildFlags) diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index c78c7fe85cf..a516d78fc87 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -304,12 +304,12 @@ examples :: String -> String -> String examples pname invokedName = unlines [ "Examples:" - , " - " <> pname <> " " <> invokedName - , " Install the package in the current directory" - , " - " <> pname <> " " <> invokedName <> " pkgname" - , " Install the package named pkgname (fetching it from hackage if necessary)" - , " - " <> pname <> " " <> invokedName <> " ./pkgfoo" - , " Install the package in the ./pkgfoo directory" + , "- " <> pname <> " " <> invokedName + , " Install the package in the current directory" + , "- " <> pname <> " " <> invokedName <> " pkgname" + , " Install the package named pkgname (fetching it from hackage if necessary)" + , "- " <> pname <> " " <> invokedName <> " ./pkgfoo" + , " Install the package in the ./pkgfoo directory" ] installCommand :: CommandUI (NixStyleFlags ClientInstallFlags) From 77dcf4a500e41fd170f67ae4dfe547c395758b52 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 12:27:39 -0400 Subject: [PATCH 097/104] Register a command under aliases too --- .../src/Distribution/Client/Cmd/UI.hs | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 117a413489e..8a47634f573 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -185,20 +185,27 @@ commandNames command = where name = commandName command +-- | Register a command under each of its names (see 'commandNames'), so that +-- the global help and the command registry list @build@, @new-build@ and +-- @v2-build@ alike, as "Distribution.Client.CmdLegacy" does for the other +-- commands. cmdSpec :: CommandUI flags -> (flags -> [String] -> action) -> [CommandSpec action] cmdSpec command action = - [CommandSpec ui (`commandAddAction` action) NormalCommand] + [ CommandSpec (renamed name) (`commandAddAction` action) NormalCommand + | name <- commandNames command + ] where - ui = - command - { commandName = stripVersionPrefix (commandName command) - , commandUsage = stripVersionPrefix . commandUsage command - , commandDescription = (stripVersionPrefix .) <$> commandDescription command - , commandNotes = (stripVersionPrefix .) <$> commandNotes command - } + renamed name = + let rename = replaceCommandAlias (commandName command) name + in command + { commandName = name + , commandUsage = rename . commandUsage command + , commandDescription = (rename .) <$> commandDescription command + , commandNotes = (rename .) <$> commandNotes command + } cmdListOptions :: CommandUI flags -> [String] cmdListOptions command = From 5a3f1f3bab003f5773786955e57b4a5f56ab80c6 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 12:28:36 -0400 Subject: [PATCH 098/104] Regenerate doc/cmd-*/*.txt --- doc/cmd-v1-help/configure.txt | 100 ++--- doc/cmd-v1-help/freeze.txt | 10 +- doc/cmd-v1-help/install.txt | 127 +++--- doc/cmd-v1-help/reconfigure.txt | 100 ++--- doc/cmd-v1-help/test.txt | 13 +- doc/cmd-v2-help/bench.txt | 127 +++--- doc/cmd-v2-help/build.txt | 559 +++++++++++------------ doc/cmd-v2-help/configure.txt | 127 +++--- doc/cmd-v2-help/exec.txt | 127 +++--- doc/cmd-v2-help/fetch.txt | 11 +- doc/cmd-v2-help/freeze.txt | 127 +++--- doc/cmd-v2-help/gen-bounds.txt | 127 +++--- doc/cmd-v2-help/haddock.txt | 127 +++--- doc/cmd-v2-help/install.txt | 560 +++++++++++++----------- doc/cmd-v2-help/list-bin.txt | 127 +++--- doc/cmd-v2-help/outdated.txt | 127 +++--- doc/cmd-v2-help/path.txt | 127 +++--- doc/cmd-v2-help/repl.txt | 131 +++--- doc/cmd-v2-help/run.txt | 127 +++--- doc/cmd-v2-help/target.txt | 127 +++--- doc/cmd-v2-help/test.txt | 127 +++--- doc/cmd-v2-help/update.txt | 127 +++--- doc/cmd-v2-hidden-help/act-as-setup.txt | 3 +- doc/setup-help/configure.txt | 92 ++-- doc/setup-help/install.txt | 5 +- doc/setup-help/test.txt | 13 +- 26 files changed, 1497 insertions(+), 1878 deletions(-) diff --git a/doc/cmd-v1-help/configure.txt b/doc/cmd-v1-help/configure.txt index 7059ef5d400..71c2c70720b 100644 --- a/doc/cmd-v1-help/configure.txt +++ b/doc/cmd-v1-help/configure.txt @@ -41,29 +41,24 @@ Flags for v1-configure: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -79,27 +74,20 @@ Flags for v1-configure: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -120,9 +108,8 @@ Flags for v1-configure: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -140,30 +127,21 @@ Flags for v1-configure: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -182,13 +160,9 @@ Flags for v1-configure: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, diff --git a/doc/cmd-v1-help/freeze.txt b/doc/cmd-v1-help/freeze.txt index 2357900bdf0..3e965fb8e01 100644 --- a/doc/cmd-v1-help/freeze.txt +++ b/doc/cmd-v1-help/freeze.txt @@ -16,14 +16,10 @@ Flags for v1-freeze: verbosity level is 1) --dry-run # Do not freeze anything, only print what would be frozen - --enable-tests # Enable freezing of the dependencies of any + --[enable|disable]-tests # Toggle freezing of the dependencies of any tests suites in the package description file. - --disable-tests # Disable freezing of the dependencies of any - tests suites in the package description file. - --enable-benchmarks # Enable freezing of the dependencies of any - benchmarks suites in the package description - file. - --disable-benchmarks # Disable freezing of the dependencies of any + --[enable|disable]-benchmarks + # Toggle freezing of the dependencies of any benchmarks suites in the package description file. --solver=SOLVER # Select dependency solver to use (default: diff --git a/doc/cmd-v1-help/install.txt b/doc/cmd-v1-help/install.txt index b4937a719cc..5e1277014b1 100644 --- a/doc/cmd-v1-help/install.txt +++ b/doc/cmd-v1-help/install.txt @@ -52,29 +52,24 @@ Flags for v1-install: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -90,27 +85,20 @@ Flags for v1-install: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -131,9 +119,8 @@ Flags for v1-install: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -151,30 +138,21 @@ Flags for v1-install: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -193,13 +171,9 @@ Flags for v1-install: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -215,8 +189,8 @@ Flags for v1-install: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -294,14 +268,16 @@ Flags for v1-install: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -344,12 +320,13 @@ Flags for v1-install: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v1-help/reconfigure.txt b/doc/cmd-v1-help/reconfigure.txt index 15d821d1358..a0a38ada0fe 100644 --- a/doc/cmd-v1-help/reconfigure.txt +++ b/doc/cmd-v1-help/reconfigure.txt @@ -40,29 +40,24 @@ Flags for v1-reconfigure: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -78,27 +73,20 @@ Flags for v1-reconfigure: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -119,9 +107,8 @@ Flags for v1-reconfigure: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -139,30 +126,21 @@ Flags for v1-reconfigure: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -181,13 +159,9 @@ Flags for v1-reconfigure: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, diff --git a/doc/cmd-v1-help/test.txt b/doc/cmd-v1-help/test.txt index 6732042f66a..2c694bdcb73 100644 --- a/doc/cmd-v1-help/test.txt +++ b/doc/cmd-v1-help/test.txt @@ -42,12 +42,13 @@ Flags for v1-test: --machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/bench.txt b/doc/cmd-v2-help/bench.txt index c5ba5a99f02..aeb5ceb2cdb 100644 --- a/doc/cmd-v2-help/bench.txt +++ b/doc/cmd-v2-help/bench.txt @@ -45,29 +45,24 @@ Flags for bench: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -83,27 +78,20 @@ Flags for bench: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -124,9 +112,8 @@ Flags for bench: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -144,30 +131,21 @@ Flags for bench: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -186,13 +164,9 @@ Flags for bench: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -208,8 +182,8 @@ Flags for bench: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -285,14 +259,16 @@ Flags for bench: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -335,12 +311,13 @@ Flags for bench: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/build.txt b/doc/cmd-v2-help/build.txt index c4d2f57a62f..1b8eafb2770 100644 --- a/doc/cmd-v2-help/build.txt +++ b/doc/cmd-v2-help/build.txt @@ -14,98 +14,10 @@ configuration from the 'cabal.project', 'cabal.project.local' and other files. Flags for build: -h, --help # Show this help text - -v[n], --verbose[=n] # Control verbosity (n is 0--3, default - verbosity level is 1) - --builddir=DIR # The directory where Cabal puts generated build - files (default dist) - --keep-temp-files # Keep temporary files. -g, --ghc # Compile with GHC --ghcjs # Compile with GHCJS --uhc # Compile with UHC - -w PATH or -wPATH, --with-compiler=PATH - # Give the path to a particular compiler --with-hc-pkg=PATH # Give the path to the package tool - --prefix=DIR # Bake this prefix in preparation of - installation - --bindir=DIR # Installation directory for executables - --libdir=DIR # Installation directory for libraries - --libsubdir=DIR # Subdirectory of libdir in which libs are - installed - --dynlibdir=DIR # Installation directory for dynamic libraries - --bytecodelibdir=DIR # Installation directory for bytecode libraries - --libexecdir=DIR # Installation directory for program executables - --libexecsubdir=DIR # Subdirectory of libexecdir in which private - executables are installed - --datadir=DIR # Installation directory for read-only data - --datasubdir=DIR # Subdirectory of datadir in which data files - are installed - --docdir=DIR # Installation directory for documentation - --htmldir=DIR # Installation directory for HTML documentation - --haddockdir=DIR # Installation directory for haddock interfaces - --sysconfdir=DIR # Installation directory for configuration files - --program-prefix=PREFIX # Prefix to be applied to installed executables - --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries - -p, --enable-library-profiling - # Enable Library profiling - --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) - --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). - --library-profiling-detail=level - # Profiling detail level for libraries only. - -O[n], --enable-optimization[=n] - # Build with optimization (n is 0--2, default is - 1) - --disable-optimization # Build without optimization - --enable-debug-info[=n] # Emit debug info (n is 0--3, default is 0) - --disable-debug-info # Don't emit debug info - --enable-build-info # Enable build information generation during - project building - --disable-build-info # Disable build information generation during - project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded - definitions can be dropped from the final - executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to - reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to - reduce binary sizes - --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation --global # Disable doing a per-user installation --package-db=DB # Append the given package database to the list @@ -116,132 +28,20 @@ Flags for build: ['global', $sandbox], depending on context. Use 'clear' to reset the list to empty. See the user guide for details. - -f FLAGS or -fFLAGS, --flags=FLAGS - # Force values for the given flags in Cabal + -f FLAGS, --flags=FLAGS # Force values for the given flags in Cabal conditionals in the .cabal file. E.g., --flags="debug -usebytestrings" forces the flag "debug" to true and "usebytestrings" to false. - --extra-include-dirs=PATH # A list of directories to search for header - files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible - (used by the test suite) - --ipid=IPID # Installed package ID to compile this package - as - --cid=CID # Installed component ID to compile this - component as - --extra-lib-dirs=PATH # A list of directories to search for external - libraries - --extra-lib-dirs-static=PATH # A list of directories to search for external - libraries when linking fully static - executables - --extra-framework-dirs=PATH # A list of directories to search for external - frameworks (OS X only) - --extra-prog-path=PATH # A list of directories to search for required - programs (in addition to the normal search - locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for - test suites listed in the package description - file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program - Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for - benchmarks listed in the package description - file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. - (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments - --allow-depending-on-private-libs - # Allow depending on private libraries. If set, - the library visibility check MUST be done - externally. - --coverage-for=UNITID # A list of unit-ids of libraries to include in - the Haskell Program Coverage report. - --ignore-build-tools # Ignore build tool dependencies. If set, - declared build tools needn't be found for - compilation to proceed. - --with-PROG=PATH # Give the path to PROG - --PROG-option=OPT # Give an extra option to PROG (passed directly - to PROG as a single argument) - --PROG-options=OPTS # Give extra options to PROG (split on spaces, - use "" to prevent splitting) - --cabal-lib-version=VERSION # Select which version of the Cabal lib to use - to build packages (useful for testing). - --enable-append # Enable appending the new config to the old - config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before - any alterations - -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT + + -c CONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, installed/source, flags) - --preference=CONSTRAINT # Specify preferences (soft constraints) on the - version of a package - --solver=SOLVER # Select dependency solver to use (default: - modular). Choices: modular. - --allow-older[=DEPS] # Ignore lower bounds in all dependencies or - DEPS - --allow-newer[=DEPS] # Ignore upper bounds in all dependencies or - DEPS - --write-ghc-environment-files=always|never|ghc8.4.4+ - # Whether to create a .ghc.environment file - after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation - --doc-index-file=TEMPLATE # A central index of haddock API documentation - (template cannot use $pkgid) - --dry-run # Do not install anything, only print what would - be installed. - --only-download # Do not build anything, only fetch the - packages. - --max-backjumps=NUM # Maximum number of backjumps allowed while - solving (default: 4000). Use a negative number - to enable unlimited backtracking. Use 0 to - disable backtracking completely. - --reorder-goals # Try to reorder goals according to certain - heuristics. Slows things down on average, but - may make backtracking faster for some - packages. - --count-conflicts # Try to speed up solving by preferring goals - that are involved in a lot of conflicts - (default). - --fine-grained-conflicts # Skip a version of a package if it does not - resolve the conflicts encountered in the last - version, as a solver optimization (default). - --minimize-conflict-set # When there is no solution, try to improve the - error message by finding a minimal conflict - set (default: false). May increase run time - significantly. - --independent-goals # Treat several goals on the command line as - independent. If several goals depend on the - same package, different versions can be - chosen. - --prefer-oldest # Prefer the oldest (instead of the latest) - versions of packages available. Useful to - determine lower bounds in the build-depends - section. + --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the solver should prefer. Oldest is useful to @@ -250,58 +50,44 @@ Flags for build: version. Installed-or-latest will prefer installed versions and the latest version otherwise. - --shadow-installed-packages # If multiple package instances of the same - version are installed, treat all but one as - shadowed. --strong-flags # Do not defer flag choices (this used to be the default in cabal-install <= 1.20). + --project-file=FILE # Set the path of the cabal.project file + (relative to the project directory when + relative) + --project-file-parser=PARSER # Set the parser to use for the project file + +Deprecated options: + --prefer-oldest # Prefer the oldest (instead of the latest) + versions of packages available. Useful to + determine lower bounds in the build-depends + section. + +Unsupported options: --allow-boot-library-installs # Allow cabal to install base, ghc-prim, integer-simple, integer-gmp, and template-haskell. - --reject-unconstrained-dependencies=none|all - # Require these packages to have constraints on - them if they are to be selected (default: - none). - --reinstall # Install even if it means installing the same - version again. - --avoid-reinstalls # Do not select versions that would - destructively overwrite installed packages. - --force-reinstalls # Reinstall packages even if they will most - likely break other installed packages. - --upgrade-dependencies # Pick the latest version for all dependencies, - rather than trying to pick an installed - version. - --only-dependencies # Install only the dependencies necessary to - build the given packages - --dependencies-only # A synonym for --only-dependencies - --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). --root-cmd=COMMAND # (No longer supported, do not use.) - --build-summary=TEMPLATE # Save build summaries to file (name template - can use $pkgid, $compiler, $os, $arch) - --build-log=TEMPLATE # Log all builds to file (name template can use - $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL - # Generate build reports to send to a remote - server (none, anonymous or detailed). - --report-planning-failure # Generate build reports when the dependency - solver fails. This is used by the Hackage - build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible - --run-tests # Run package test suites during installation. - --semaphore # Use a semaphore so GHC can compile components - in parallel - -j[NUM], --jobs[=NUM] # Run NUM jobs simultaneously (or '$ncpus' if no - NUM is given). - --keep-going # After a build failure, continue to build other - unaffected packages. - --offline # Don't download packages from the Internet. - --build-timings # Print elapsed time for each build phase. + +Install layout options: + --builddir=DIR, --prefix=DIR, --bindir=DIR, --libdir=DIR, --libsubdir=DIR, + --dynlibdir=DIR, --bytecodelibdir=DIR, --libexecdir=DIR, + --libexecsubdir=DIR, --datadir=DIR, --datasubdir=DIR, --docdir=DIR, + --htmldir=DIR, --haddockdir=DIR, --sysconfdir=DIR, --program-prefix=PREFIX, + --program-suffix=SUFFIX, --ipid=IPID, --cid=CID, --reinstall, + --avoid-reinstalls, --force-reinstalls, --run-tests, + --haddock-resources-dir=DIR, --haddock-output-dir=DIR, --project-dir=DIR + +Irrelevant options: + --[enable|disable]-per-component + # Toggle Per-component builds when possible + +Haddock options: + --[enable|disable]-documentation + # Toggle building of documentation + --doc-index-file=TEMPLATE # A central index of haddock API documentation + (template cannot use $pkgid) --haddock-hoogle # Generate a hoogle database --haddock-html # Generate HTML documentation (the default) --haddock-html-location=URL # Location of HTML documentation for @@ -315,35 +101,45 @@ Flags for build: --haddock-internal # Run haddock for internal modules and include all symbols --haddock-css=PATH # Use PATH as the haddock stylesheet - --haddock-hyperlink-source # Hyperlink the documentation to the source code + + --haddock-hyperlink-source, --haddock-hyperlink-sources, --haddock-hyperlinked-source + # Hyperlink the documentation to the source code --haddock-quickjump # Generate an index for interactive documentation navigation --haddock-hscolour-css=PATH # Use PATH as the HsColour stylesheet + --haddock-contents-location=URL # Bake URL in as the location for the contents page --haddock-base-url=URL # Base URL for static files. - --haddock-resources-dir=DIR # Location of Haddocks static / auxiliary files - --haddock-output-dir=DIR # Generate haddock documentation into this - directory. This flag is provided as a - technology preview and is subject to change in - the next releases. --haddock-use-unicode # Pass --use-unicode option to haddock + +Test options: + --[enable|disable]-tests # Toggle dependency checking and compilation for + test suites listed in the package description + file. --test-log=TEMPLATE # Log all test suite results to file (name template can use $pkgid, $compiler, $os, $arch, $test-suite, $result) --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in - real time; no log file. + + --test-show-details=always|never|failures|streaming|direct + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. + --test-fail-when-no-test-suites # Exit with failure when no test suites are found. @@ -355,6 +151,13 @@ Flags for build: directly as a single argument; name template can use $pkgid, $compiler, $os, $arch, $test-suite) + +Benchmark options: + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for + benchmarks listed in the package description + file. + --benchmark-options=TEMPLATES # Give extra options to benchmark executables (split on spaces, use "" to prevent splitting; @@ -364,22 +167,234 @@ Flags for build: (passed directly as a single argument; name template can use $pkgid, $compiler, $os, $arch, $benchmark) - --project-dir=DIR # Set the path of the project directory - --project-file=FILE # Set the path of the cabal.project file - (relative to the project directory when - relative) - --project-file-parser=PARSER # Set the parser to use for the project file + +Profiling options: + -p, --enable-library-profiling + # Enable Library profiling + --disable-library-profiling # Disable Library profiling + --[enable|disable]-profiling # Toggle Executable and library profiling + + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) + --profiling-detail=level # Profiling detail level for executable and + library (default, none, exported-functions, + toplevel-functions, all-functions, late). + + --library-profiling-detail=level + # Profiling detail level for libraries only. + +Dependency solving options: + --allow-depending-on-private-libs + # Allow depending on private libraries. If set, + the library visibility check MUST be done + externally. + --ignore-build-tools # Ignore build tool dependencies. If set, + declared build tools needn't be found for + compilation to proceed. + --preference=CONSTRAINT # Specify preferences (soft constraints) on the + version of a package + --solver=SOLVER # Select dependency solver to use (default: + modular). Choices: modular. + --allow-older[=DEPS] # Ignore lower bounds in all dependencies or + DEPS + --allow-newer[=DEPS] # Ignore upper bounds in all dependencies or + DEPS + --max-backjumps=NUM # Maximum number of backjumps allowed while + solving (default: 4000). Use a negative number + to enable unlimited backtracking. Use 0 to + disable backtracking completely. + --reorder-goals # Try to reorder goals according to certain + heuristics. Slows things down on average, but + may make backtracking faster for some + packages. + --count-conflicts # Try to speed up solving by preferring goals + that are involved in a lot of conflicts + (default). + --fine-grained-conflicts # Skip a version of a package if it does not + resolve the conflicts encountered in the last + version, as a solver optimization (default). + --minimize-conflict-set # When there is no solution, try to improve the + error message by finding a minimal conflict + set (default: false). May increase run time + significantly. + --independent-goals # Treat several goals on the command line as + independent. If several goals depend on the + same package, different versions can be + chosen. + --shadow-installed-packages # If multiple package instances of the same + version are installed, treat all but one as + shadowed. + + --reject-unconstrained-dependencies=none|all + # Require these packages to have constraints on + them if they are to be selected (default: + none). + --upgrade-dependencies # Pick the latest version for all dependencies, + rather than trying to pick an installed + version. + --only-dependencies # Install only the dependencies necessary to + build the given packages + --dependencies-only # A synonym for --only-dependencies + --index-state=STATE # Use source package index state as it existed + at a previous time. Accepts unix-timestamps + (e.g. '@1474732068'), ISO8601 UTC timestamps + (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' + (default: 'HEAD'). + +Executable build options: + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + + --[enable|disable]-executable-static + # Toggle Executable fully static linking + + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded + definitions can be dropped from the final + executable (GHC 7.8+) + + --[enable|disable]-split-objs + # Toggle split library into smaller objects to + reduce binary sizes (GHC 6.6+) + + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to + reduce binary sizes + + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to + reduce binary sizes + +Library build options: + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + + --[enable|disable]-library-bytecode + # Toggle Bytecode library + + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --extra-lib-dirs-static=PATH # A list of directories to search for external + libraries when linking fully static + executables + +Coverage options: + --[enable|disable]-coverage # Toggle build package with Haskell Program + Coverage. (GHC only) + + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program + Coverage. (GHC only) (DEPRECATED) + --coverage-for=UNITID # A list of unit-ids of libraries to include in + the Haskell Program Coverage report. + +Output and artifact options: + --enable-debug-info[=n] # Emit debug info (n is 0--3, default is 0) + --disable-debug-info # Don't emit debug info + --enable-build-info # Enable build information generation during + project building + --disable-build-info # Disable build information generation during + project building + + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible + (used by the test suite) + + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. + (GHC only) + + --write-ghc-environment-files=always|never|ghc8.4.4+ + # Whether to create a .ghc.environment file + after a successful build (v2-build only) + +Configure-phase options: + --configure-option=OPT # Extra option for configure + --[enable|disable]-append # Toggle appending the new config to the old + config file + --[enable|disable]-backup # Toggle the backup of the config file before + any alterations + +Build phase control options: + --dry-run # Do not install anything, only print what would + be installed. + --only-download # Do not build anything, only fetch the + packages. --only-configure # Instead of performing a full build just run the configure step +Compiler and parallelism options: + -w PATH, --with-compiler=PATH + # Give the path to a particular compiler + + -O[n], --enable-optimization[=n], --enable-optimisation[=n] + # Build with optimization (n is 0--2, default is + 1) + + --disable-optimization, --disable-optimisation + # Build without optimization + --cabal-lib-version=VERSION # Select which version of the Cabal lib to use + to build packages (useful for testing). + --semaphore # Use a semaphore so GHC can compile components + in parallel + -j[NUM], --jobs[=NUM] # Run NUM jobs simultaneously (or '$ncpus' if no + NUM is given). + --keep-going # After a build failure, continue to build other + unaffected packages. + --offline # Don't download packages from the Internet. + +Logging and reporting options: + -v[n], --verbose[=n] # Control verbosity (n is 0--3, default + verbosity level is 1) + --keep-temp-files # Keep temporary files. + --build-summary=TEMPLATE # Save build summaries to file (name template + can use $pkgid, $compiler, $os, $arch) + --build-log=TEMPLATE # Log all builds to file (name template can use + $pkgid, $compiler, $os, $arch) + + --remote-build-reporting=none|anonymous|detailed + # Generate build reports to send to a remote + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. + --report-planning-failure # Generate build reports when the dependency + solver fails. This is used by the Hackage + build bot. + --build-timings # Print elapsed time for each build phase. + +Include and linker path options: + --extra-include-dirs=PATH # A list of directories to search for header + files + --extra-lib-dirs=PATH # A list of directories to search for external + libraries + --extra-framework-dirs=PATH # A list of directories to search for external + frameworks (OS X only) + --extra-prog-path=PATH # A list of directories to search for required + programs (in addition to the normal search + locations) + +Program override options: + --with-PROG=PATH # Give the path to PROG + --PROG-option=OPT # Give an extra option to PROG (passed directly + to PROG as a single argument) + --PROG-options=OPTS # Give extra options to PROG (split on spaces, + use "" to prevent splitting) + Examples: - cabal build +- cabal build Build the package in the current directory or all packages in the project - cabal build pkgname +- cabal build pkgname Build the package named pkgname in the project - cabal build ./pkgfoo +- cabal build ./pkgfoo Build the package in the ./pkgfoo directory - cabal build cname +- cabal build cname Build the component named cname in the project - cabal build cname --enable-profiling +- cabal build cname --enable-profiling Build the component in profiling mode (including dependencies as needed) diff --git a/doc/cmd-v2-help/configure.txt b/doc/cmd-v2-help/configure.txt index c97f66063b1..b389faab3a9 100644 --- a/doc/cmd-v2-help/configure.txt +++ b/doc/cmd-v2-help/configure.txt @@ -58,29 +58,24 @@ Flags for configure: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -96,27 +91,20 @@ Flags for configure: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -137,9 +125,8 @@ Flags for configure: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -157,30 +144,21 @@ Flags for configure: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -199,13 +177,9 @@ Flags for configure: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -221,8 +195,8 @@ Flags for configure: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -298,14 +272,16 @@ Flags for configure: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -348,12 +324,13 @@ Flags for configure: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/exec.txt b/doc/cmd-v2-help/exec.txt index ea4368e9cd8..6ea13b19414 100644 --- a/doc/cmd-v2-help/exec.txt +++ b/doc/cmd-v2-help/exec.txt @@ -47,29 +47,24 @@ Flags for exec: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -85,27 +80,20 @@ Flags for exec: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -126,9 +114,8 @@ Flags for exec: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -146,30 +133,21 @@ Flags for exec: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -188,13 +166,9 @@ Flags for exec: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -210,8 +184,8 @@ Flags for exec: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -287,14 +261,16 @@ Flags for exec: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -337,12 +313,13 @@ Flags for exec: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/fetch.txt b/doc/cmd-v2-help/fetch.txt index b66044ab234..a986883b91b 100644 --- a/doc/cmd-v2-help/fetch.txt +++ b/doc/cmd-v2-help/fetch.txt @@ -13,18 +13,13 @@ Flags for fetch: --no-dependencies # Ignore dependencies --dry-run # Do not install anything, only print what would be installed. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. --solver=SOLVER # Select dependency solver to use (default: modular). Choices: modular. --max-backjumps=NUM # Maximum number of backjumps allowed while diff --git a/doc/cmd-v2-help/freeze.txt b/doc/cmd-v2-help/freeze.txt index 64269ce7f8e..e9c0f1ce67c 100644 --- a/doc/cmd-v2-help/freeze.txt +++ b/doc/cmd-v2-help/freeze.txt @@ -50,29 +50,24 @@ Flags for freeze: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -88,27 +83,20 @@ Flags for freeze: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -129,9 +117,8 @@ Flags for freeze: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -149,30 +136,21 @@ Flags for freeze: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -191,13 +169,9 @@ Flags for freeze: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -213,8 +187,8 @@ Flags for freeze: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -290,14 +264,16 @@ Flags for freeze: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -340,12 +316,13 @@ Flags for freeze: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/gen-bounds.txt b/doc/cmd-v2-help/gen-bounds.txt index 8764aac5bda..1f9fb8003b5 100644 --- a/doc/cmd-v2-help/gen-bounds.txt +++ b/doc/cmd-v2-help/gen-bounds.txt @@ -36,29 +36,24 @@ Flags for gen-bounds: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -74,27 +69,20 @@ Flags for gen-bounds: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -115,9 +103,8 @@ Flags for gen-bounds: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -135,30 +122,21 @@ Flags for gen-bounds: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -177,13 +155,9 @@ Flags for gen-bounds: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -199,8 +173,8 @@ Flags for gen-bounds: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -276,14 +250,16 @@ Flags for gen-bounds: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -326,12 +302,13 @@ Flags for gen-bounds: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/haddock.txt b/doc/cmd-v2-help/haddock.txt index 2e5046e47f7..fc8b2001e6c 100644 --- a/doc/cmd-v2-help/haddock.txt +++ b/doc/cmd-v2-help/haddock.txt @@ -50,29 +50,24 @@ Flags for haddock: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -88,27 +83,20 @@ Flags for haddock: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -129,9 +117,8 @@ Flags for haddock: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -149,30 +136,21 @@ Flags for haddock: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -191,13 +169,9 @@ Flags for haddock: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -213,8 +187,8 @@ Flags for haddock: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -290,14 +264,16 @@ Flags for haddock: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -340,12 +316,13 @@ Flags for haddock: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/install.txt b/doc/cmd-v2-help/install.txt index 8850a2a2890..90e7c57da03 100644 --- a/doc/cmd-v2-help/install.txt +++ b/doc/cmd-v2-help/install.txt @@ -15,80 +15,10 @@ implemented. Flags for install: -h, --help # Show this help text - -v[n], --verbose[=n] # Control verbosity (n is 0--3, default - verbosity level is 1) - --builddir=DIR # The directory where Cabal puts generated build - files (default dist) - --keep-temp-files # Keep temporary files. -g, --ghc # Compile with GHC --ghcjs # Compile with GHCJS --uhc # Compile with UHC - -w PATH or -wPATH, --with-compiler=PATH - # Give the path to a particular compiler --with-hc-pkg=PATH # Give the path to the package tool - --program-prefix=PREFIX # Prefix to be applied to installed executables - --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries - -p, --enable-library-profiling - # Enable Library profiling - --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) - --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). - --library-profiling-detail=level - # Profiling detail level for libraries only. - -O[n], --enable-optimization[=n] - # Build with optimization (n is 0--2, default is - 1) - --disable-optimization # Build without optimization - --enable-debug-info[=n] # Emit debug info (n is 0--3, default is 0) - --disable-debug-info # Don't emit debug info - --enable-build-info # Enable build information generation during - project building - --disable-build-info # Disable build information generation during - project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded - definitions can be dropped from the final - executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to - reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to - reduce binary sizes - --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation --global # Disable doing a per-user installation --package-db=DB # Append the given package database to the list @@ -99,132 +29,20 @@ Flags for install: ['global', $sandbox], depending on context. Use 'clear' to reset the list to empty. See the user guide for details. - -f FLAGS or -fFLAGS, --flags=FLAGS - # Force values for the given flags in Cabal + -f FLAGS, --flags=FLAGS # Force values for the given flags in Cabal conditionals in the .cabal file. E.g., --flags="debug -usebytestrings" forces the flag "debug" to true and "usebytestrings" to false. - --extra-include-dirs=PATH # A list of directories to search for header - files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible - (used by the test suite) - --ipid=IPID # Installed package ID to compile this package - as - --cid=CID # Installed component ID to compile this - component as - --extra-lib-dirs=PATH # A list of directories to search for external - libraries - --extra-lib-dirs-static=PATH # A list of directories to search for external - libraries when linking fully static - executables - --extra-framework-dirs=PATH # A list of directories to search for external - frameworks (OS X only) - --extra-prog-path=PATH # A list of directories to search for required - programs (in addition to the normal search - locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for - test suites listed in the package description - file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program - Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for - benchmarks listed in the package description - file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. - (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments - --allow-depending-on-private-libs - # Allow depending on private libraries. If set, - the library visibility check MUST be done - externally. - --coverage-for=UNITID # A list of unit-ids of libraries to include in - the Haskell Program Coverage report. - --ignore-build-tools # Ignore build tool dependencies. If set, - declared build tools needn't be found for - compilation to proceed. - --with-PROG=PATH # Give the path to PROG - --PROG-option=OPT # Give an extra option to PROG (passed directly - to PROG as a single argument) - --PROG-options=OPTS # Give extra options to PROG (split on spaces, - use "" to prevent splitting) - --cabal-lib-version=VERSION # Select which version of the Cabal lib to use - to build packages (useful for testing). - --enable-append # Enable appending the new config to the old - config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before - any alterations - -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT + + -c CONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, installed/source, flags) - --preference=CONSTRAINT # Specify preferences (soft constraints) on the - version of a package - --solver=SOLVER # Select dependency solver to use (default: - modular). Choices: modular. - --allow-older[=DEPS] # Ignore lower bounds in all dependencies or - DEPS - --allow-newer[=DEPS] # Ignore upper bounds in all dependencies or - DEPS - --write-ghc-environment-files=always|never|ghc8.4.4+ - # Whether to create a .ghc.environment file - after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation - --doc-index-file=TEMPLATE # A central index of haddock API documentation - (template cannot use $pkgid) - --dry-run # Do not install anything, only print what would - be installed. - --only-download # Do not build anything, only fetch the - packages. - --max-backjumps=NUM # Maximum number of backjumps allowed while - solving (default: 4000). Use a negative number - to enable unlimited backtracking. Use 0 to - disable backtracking completely. - --reorder-goals # Try to reorder goals according to certain - heuristics. Slows things down on average, but - may make backtracking faster for some - packages. - --count-conflicts # Try to speed up solving by preferring goals - that are involved in a lot of conflicts - (default). - --fine-grained-conflicts # Skip a version of a package if it does not - resolve the conflicts encountered in the last - version, as a solver optimization (default). - --minimize-conflict-set # When there is no solution, try to improve the - error message by finding a minimal conflict - set (default: false). May increase run time - significantly. - --independent-goals # Treat several goals on the command line as - independent. If several goals depend on the - same package, different versions can be - chosen. - --prefer-oldest # Prefer the oldest (instead of the latest) - versions of packages available. Useful to - determine lower bounds in the build-depends - section. + --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the solver should prefer. Oldest is useful to @@ -233,58 +51,54 @@ Flags for install: version. Installed-or-latest will prefer installed versions and the latest version otherwise. - --shadow-installed-packages # If multiple package instances of the same - version are installed, treat all but one as - shadowed. --strong-flags # Do not defer flag choices (this used to be the default in cabal-install <= 1.20). + --project-file=FILE # Set the path of the cabal.project file + (relative to the project directory when + relative) + -z, --ignore-project # Ignore local project configuration (unless + --project-dir or --project-file is also set) + --project-file-parser=PARSER # Set the parser to use for the project file + --lib # Install libraries rather than executables from + the target package (provisional, see + https://github.com/haskell/cabal/issues/6481 + for more information). + --package-env=ENV, --env=ENV # Set the environment file that may be modified. + + --overwrite-policy=always|never|prompt + # How to handle already existing symlinks. + + --install-method=default|copy|symlink + # How to install the executables. + +Deprecated options: + --prefer-oldest # Prefer the oldest (instead of the latest) + versions of packages available. Useful to + determine lower bounds in the build-depends + section. + +Unsupported options: --allow-boot-library-installs # Allow cabal to install base, ghc-prim, integer-simple, integer-gmp, and template-haskell. - --reject-unconstrained-dependencies=none|all - # Require these packages to have constraints on - them if they are to be selected (default: - none). - --reinstall # Install even if it means installing the same - version again. - --avoid-reinstalls # Do not select versions that would - destructively overwrite installed packages. - --force-reinstalls # Reinstall packages even if they will most - likely break other installed packages. - --upgrade-dependencies # Pick the latest version for all dependencies, - rather than trying to pick an installed - version. - --only-dependencies # Install only the dependencies necessary to - build the given packages - --dependencies-only # A synonym for --only-dependencies - --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). --root-cmd=COMMAND # (No longer supported, do not use.) - --build-summary=TEMPLATE # Save build summaries to file (name template - can use $pkgid, $compiler, $os, $arch) - --build-log=TEMPLATE # Log all builds to file (name template can use - $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL - # Generate build reports to send to a remote - server (none, anonymous or detailed). - --report-planning-failure # Generate build reports when the dependency - solver fails. This is used by the Hackage - build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible - --run-tests # Run package test suites during installation. - --semaphore # Use a semaphore so GHC can compile components - in parallel - -j[NUM], --jobs[=NUM] # Run NUM jobs simultaneously (or '$ncpus' if no - NUM is given). - --keep-going # After a build failure, continue to build other - unaffected packages. - --offline # Don't download packages from the Internet. - --build-timings # Print elapsed time for each build phase. + +Install layout options: + --builddir=DIR, --program-prefix=PREFIX, --program-suffix=SUFFIX, + --ipid=IPID, --cid=CID, --reinstall, --avoid-reinstalls, --force-reinstalls, + --run-tests, --haddock-resources-dir=DIR, --haddock-output-dir=DIR, + --project-dir=DIR, --installdir=DIR + +Irrelevant options: + --[enable|disable]-per-component + # Toggle Per-component builds when possible + +Haddock options: + --[enable|disable]-documentation + # Toggle building of documentation + --doc-index-file=TEMPLATE # A central index of haddock API documentation + (template cannot use $pkgid) --haddock-hoogle # Generate a hoogle database --haddock-html # Generate HTML documentation (the default) --haddock-html-location=URL # Location of HTML documentation for @@ -298,35 +112,45 @@ Flags for install: --haddock-internal # Run haddock for internal modules and include all symbols --haddock-css=PATH # Use PATH as the haddock stylesheet - --haddock-hyperlink-source # Hyperlink the documentation to the source code + + --haddock-hyperlink-source, --haddock-hyperlink-sources, --haddock-hyperlinked-source + # Hyperlink the documentation to the source code --haddock-quickjump # Generate an index for interactive documentation navigation --haddock-hscolour-css=PATH # Use PATH as the HsColour stylesheet + --haddock-contents-location=URL # Bake URL in as the location for the contents page --haddock-base-url=URL # Base URL for static files. - --haddock-resources-dir=DIR # Location of Haddocks static / auxiliary files - --haddock-output-dir=DIR # Generate haddock documentation into this - directory. This flag is provided as a - technology preview and is subject to change in - the next releases. --haddock-use-unicode # Pass --use-unicode option to haddock + +Test options: + --[enable|disable]-tests # Toggle dependency checking and compilation for + test suites listed in the package description + file. --test-log=TEMPLATE # Log all test suite results to file (name template can use $pkgid, $compiler, $os, $arch, $test-suite, $result) --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in - real time; no log file. + + --test-show-details=always|never|failures|streaming|direct + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. + --test-fail-when-no-test-suites # Exit with failure when no test suites are found. @@ -338,6 +162,13 @@ Flags for install: directly as a single argument; name template can use $pkgid, $compiler, $os, $arch, $test-suite) + +Benchmark options: + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for + benchmarks listed in the package description + file. + --benchmark-options=TEMPLATES # Give extra options to benchmark executables (split on spaces, use "" to prevent splitting; @@ -347,29 +178,228 @@ Flags for install: (passed directly as a single argument; name template can use $pkgid, $compiler, $os, $arch, $benchmark) - --project-dir=DIR # Set the path of the project directory - --project-file=FILE # Set the path of the cabal.project file - (relative to the project directory when - relative) - -z, --ignore-project # Ignore local project configuration (unless - --project-dir or --project-file is also set) - --project-file-parser=PARSER # Set the parser to use for the project file - --lib # Install libraries rather than executables from - the target package (provisional, see - https://github.com/haskell/cabal/issues/6481 - for more information). - --package-env=ENV # Set the environment file that may be modified. - --overwrite-policy=always|never|prompt - # How to handle already existing symlinks. - --install-method=default|copy|symlink - # How to install the executables. - --installdir=DIR # Where to install (by symlinking or copying) - the executables in. + +Profiling options: + -p, --enable-library-profiling + # Enable Library profiling + --disable-library-profiling # Disable Library profiling + --[enable|disable]-profiling # Toggle Executable and library profiling + + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) + --profiling-detail=level # Profiling detail level for executable and + library (default, none, exported-functions, + toplevel-functions, all-functions, late). + + --library-profiling-detail=level + # Profiling detail level for libraries only. + +Dependency solving options: + --allow-depending-on-private-libs + # Allow depending on private libraries. If set, + the library visibility check MUST be done + externally. + --ignore-build-tools # Ignore build tool dependencies. If set, + declared build tools needn't be found for + compilation to proceed. + --preference=CONSTRAINT # Specify preferences (soft constraints) on the + version of a package + --solver=SOLVER # Select dependency solver to use (default: + modular). Choices: modular. + --allow-older[=DEPS] # Ignore lower bounds in all dependencies or + DEPS + --allow-newer[=DEPS] # Ignore upper bounds in all dependencies or + DEPS + --max-backjumps=NUM # Maximum number of backjumps allowed while + solving (default: 4000). Use a negative number + to enable unlimited backtracking. Use 0 to + disable backtracking completely. + --reorder-goals # Try to reorder goals according to certain + heuristics. Slows things down on average, but + may make backtracking faster for some + packages. + --count-conflicts # Try to speed up solving by preferring goals + that are involved in a lot of conflicts + (default). + --fine-grained-conflicts # Skip a version of a package if it does not + resolve the conflicts encountered in the last + version, as a solver optimization (default). + --minimize-conflict-set # When there is no solution, try to improve the + error message by finding a minimal conflict + set (default: false). May increase run time + significantly. + --independent-goals # Treat several goals on the command line as + independent. If several goals depend on the + same package, different versions can be + chosen. + --shadow-installed-packages # If multiple package instances of the same + version are installed, treat all but one as + shadowed. + + --reject-unconstrained-dependencies=none|all + # Require these packages to have constraints on + them if they are to be selected (default: + none). + --upgrade-dependencies # Pick the latest version for all dependencies, + rather than trying to pick an installed + version. + --only-dependencies # Install only the dependencies necessary to + build the given packages + --dependencies-only # A synonym for --only-dependencies + --index-state=STATE # Use source package index state as it existed + at a previous time. Accepts unix-timestamps + (e.g. '@1474732068'), ISO8601 UTC timestamps + (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' + (default: 'HEAD'). + +Executable build options: + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + + --[enable|disable]-executable-static + # Toggle Executable fully static linking + + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded + definitions can be dropped from the final + executable (GHC 7.8+) + + --[enable|disable]-split-objs + # Toggle split library into smaller objects to + reduce binary sizes (GHC 6.6+) + + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to + reduce binary sizes + + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to + reduce binary sizes + +Library build options: + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + + --[enable|disable]-library-bytecode + # Toggle Bytecode library + + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --extra-lib-dirs-static=PATH # A list of directories to search for external + libraries when linking fully static + executables + +Coverage options: + --[enable|disable]-coverage # Toggle build package with Haskell Program + Coverage. (GHC only) + + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program + Coverage. (GHC only) (DEPRECATED) + --coverage-for=UNITID # A list of unit-ids of libraries to include in + the Haskell Program Coverage report. + +Output and artifact options: + --enable-debug-info[=n] # Emit debug info (n is 0--3, default is 0) + --disable-debug-info # Don't emit debug info + --enable-build-info # Enable build information generation during + project building + --disable-build-info # Disable build information generation during + project building + + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible + (used by the test suite) + + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. + (GHC only) + + --write-ghc-environment-files=always|never|ghc8.4.4+ + # Whether to create a .ghc.environment file + after a successful build (v2-build only) + +Configure-phase options: + --configure-option=OPT # Extra option for configure + --[enable|disable]-append # Toggle appending the new config to the old + config file + --[enable|disable]-backup # Toggle the backup of the config file before + any alterations + +Build phase control options: + --dry-run # Do not install anything, only print what would + be installed. + --only-download # Do not build anything, only fetch the + packages. + +Compiler and parallelism options: + -w PATH, --with-compiler=PATH + # Give the path to a particular compiler + + -O[n], --enable-optimization[=n], --enable-optimisation[=n] + # Build with optimization (n is 0--2, default is + 1) + + --disable-optimization, --disable-optimisation + # Build without optimization + --cabal-lib-version=VERSION # Select which version of the Cabal lib to use + to build packages (useful for testing). + --semaphore # Use a semaphore so GHC can compile components + in parallel + -j[NUM], --jobs[=NUM] # Run NUM jobs simultaneously (or '$ncpus' if no + NUM is given). + --keep-going # After a build failure, continue to build other + unaffected packages. + --offline # Don't download packages from the Internet. + +Logging and reporting options: + -v[n], --verbose[=n] # Control verbosity (n is 0--3, default + verbosity level is 1) + --keep-temp-files # Keep temporary files. + --build-summary=TEMPLATE # Save build summaries to file (name template + can use $pkgid, $compiler, $os, $arch) + --build-log=TEMPLATE # Log all builds to file (name template can use + $pkgid, $compiler, $os, $arch) + + --remote-build-reporting=none|anonymous|detailed + # Generate build reports to send to a remote + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. + --report-planning-failure # Generate build reports when the dependency + solver fails. This is used by the Hackage + build bot. + --build-timings # Print elapsed time for each build phase. + +Include and linker path options: + --extra-include-dirs=PATH # A list of directories to search for header + files + --extra-lib-dirs=PATH # A list of directories to search for external + libraries + --extra-framework-dirs=PATH # A list of directories to search for external + frameworks (OS X only) + --extra-prog-path=PATH # A list of directories to search for required + programs (in addition to the normal search + locations) + +Program override options: + --with-PROG=PATH # Give the path to PROG + --PROG-option=OPT # Give an extra option to PROG (passed directly + to PROG as a single argument) + --PROG-options=OPTS # Give extra options to PROG (split on spaces, + use "" to prevent splitting) Examples: - cabal install +- cabal install Install the package in the current directory - cabal install pkgname +- cabal install pkgname Install the package named pkgname (fetching it from hackage if necessary) - cabal install ./pkgfoo +- cabal install ./pkgfoo Install the package in the ./pkgfoo directory diff --git a/doc/cmd-v2-help/list-bin.txt b/doc/cmd-v2-help/list-bin.txt index 3b8b8f01156..27703698672 100644 --- a/doc/cmd-v2-help/list-bin.txt +++ b/doc/cmd-v2-help/list-bin.txt @@ -37,29 +37,24 @@ Flags for list-bin: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -75,27 +70,20 @@ Flags for list-bin: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -116,9 +104,8 @@ Flags for list-bin: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -136,30 +123,21 @@ Flags for list-bin: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -178,13 +156,9 @@ Flags for list-bin: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -200,8 +174,8 @@ Flags for list-bin: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -277,14 +251,16 @@ Flags for list-bin: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -327,12 +303,13 @@ Flags for list-bin: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/outdated.txt b/doc/cmd-v2-help/outdated.txt index 85a07dd7493..75fce9fdb63 100644 --- a/doc/cmd-v2-help/outdated.txt +++ b/doc/cmd-v2-help/outdated.txt @@ -38,29 +38,24 @@ Flags for outdated: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -76,27 +71,20 @@ Flags for outdated: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -117,9 +105,8 @@ Flags for outdated: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -137,30 +124,21 @@ Flags for outdated: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -179,13 +157,9 @@ Flags for outdated: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -201,8 +175,8 @@ Flags for outdated: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -278,14 +252,16 @@ Flags for outdated: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -328,12 +304,13 @@ Flags for outdated: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/path.txt b/doc/cmd-v2-help/path.txt index 74f4a3b3355..18f9359ab65 100644 --- a/doc/cmd-v2-help/path.txt +++ b/doc/cmd-v2-help/path.txt @@ -39,29 +39,24 @@ Flags for path: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -77,27 +72,20 @@ Flags for path: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -118,9 +106,8 @@ Flags for path: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -138,30 +125,21 @@ Flags for path: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -180,13 +158,9 @@ Flags for path: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -202,8 +176,8 @@ Flags for path: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -279,14 +253,16 @@ Flags for path: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -329,12 +305,13 @@ Flags for path: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/repl.txt b/doc/cmd-v2-help/repl.txt index 2913c652167..c8f1f42a703 100644 --- a/doc/cmd-v2-help/repl.txt +++ b/doc/cmd-v2-help/repl.txt @@ -48,29 +48,24 @@ Flags for repl: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -86,27 +81,20 @@ Flags for repl: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -127,9 +115,8 @@ Flags for repl: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -147,30 +134,21 @@ Flags for repl: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -189,13 +167,9 @@ Flags for repl: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -211,8 +185,8 @@ Flags for repl: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -288,14 +262,16 @@ Flags for repl: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -338,12 +314,13 @@ Flags for repl: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. @@ -385,8 +362,8 @@ Flags for repl: presented to GHCi. --no-transitive-deps # Don't automatically include transitive dependencies of requested packages. - --enable-multi-repl # Enable multi-component repl sessions - --disable-multi-repl # Disable multi-component repl sessions + --[enable|disable]-multi-repl + # Toggle multi-component repl sessions Examples, open an interactive session: cabal repl diff --git a/doc/cmd-v2-help/run.txt b/doc/cmd-v2-help/run.txt index f8dd2b32a58..1b4da5724a4 100644 --- a/doc/cmd-v2-help/run.txt +++ b/doc/cmd-v2-help/run.txt @@ -51,29 +51,24 @@ Flags for run: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -89,27 +84,20 @@ Flags for run: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -130,9 +118,8 @@ Flags for run: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -150,30 +137,21 @@ Flags for run: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -192,13 +170,9 @@ Flags for run: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -214,8 +188,8 @@ Flags for run: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -291,14 +265,16 @@ Flags for run: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -341,12 +317,13 @@ Flags for run: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/target.txt b/doc/cmd-v2-help/target.txt index 6dddae62364..89574d3bd84 100644 --- a/doc/cmd-v2-help/target.txt +++ b/doc/cmd-v2-help/target.txt @@ -67,29 +67,24 @@ Flags for target: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -105,27 +100,20 @@ Flags for target: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -146,9 +134,8 @@ Flags for target: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -166,30 +153,21 @@ Flags for target: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -208,13 +186,9 @@ Flags for target: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -230,8 +204,8 @@ Flags for target: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -307,14 +281,16 @@ Flags for target: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -357,12 +333,13 @@ Flags for target: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/test.txt b/doc/cmd-v2-help/test.txt index 00c529d1a3b..c80741943bc 100644 --- a/doc/cmd-v2-help/test.txt +++ b/doc/cmd-v2-help/test.txt @@ -47,29 +47,24 @@ Flags for test: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -85,27 +80,20 @@ Flags for test: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -126,9 +114,8 @@ Flags for test: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -146,30 +133,21 @@ Flags for test: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -188,13 +166,9 @@ Flags for test: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -210,8 +184,8 @@ Flags for test: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -287,14 +261,16 @@ Flags for test: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -337,12 +313,13 @@ Flags for test: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-help/update.txt b/doc/cmd-v2-help/update.txt index cc4e6a3ea26..ac629a1e4f9 100644 --- a/doc/cmd-v2-help/update.txt +++ b/doc/cmd-v2-help/update.txt @@ -37,29 +37,24 @@ Flags for update: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -75,27 +70,20 @@ Flags for update: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to - reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -116,9 +104,8 @@ Flags for update: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -136,30 +123,21 @@ Flags for update: locations) --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program - Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs @@ -178,13 +156,9 @@ Flags for update: use "" to prevent splitting) --cabal-lib-version=VERSION # Select which version of the Cabal lib to use to build packages (useful for testing). - --enable-append # Enable appending the new config to the old + --[enable|disable]-append # Toggle appending the new config to the old config file - --disable-append # Disable appending the new config to the old - config file - --enable-backup # Enable the backup of the config file before - any alterations - --disable-backup # Disable the backup of the config file before + --[enable|disable]-backup # Toggle the backup of the config file before any alterations -c CONSTRAINT or -cCONSTRAINT, --constraint=CONSTRAINT # Specify constraints on a package (version, @@ -200,8 +174,8 @@ Flags for update: --write-ghc-environment-files=always|never|ghc8.4.4+ # Whether to create a .ghc.environment file after a successful build (v2-build only) - --enable-documentation # Enable building of documentation - --disable-documentation # Disable building of documentation + --[enable|disable]-documentation + # Toggle building of documentation --doc-index-file=TEMPLATE # A central index of haddock API documentation (template cannot use $pkgid) --dry-run # Do not install anything, only print what would @@ -277,14 +251,16 @@ Flags for update: can use $pkgid, $compiler, $os, $arch) --build-log=TEMPLATE # Log all builds to file (name template can use $pkgid, $compiler, $os, $arch) - --remote-build-reporting=LEVEL + --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server (none, anonymous or detailed). + server: - none: do not report, - anonymous: + report without identifying information, - + detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. - --enable-per-component # Enable Per-component builds when possible - --disable-per-component # Disable Per-component builds when possible + --[enable|disable]-per-component + # Toggle Per-component builds when possible --run-tests # Run package test suites during installation. --semaphore # Use a semaphore so GHC can compile components in parallel @@ -327,12 +303,13 @@ Flags for update: --test-machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --test-show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --test-show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. diff --git a/doc/cmd-v2-hidden-help/act-as-setup.txt b/doc/cmd-v2-hidden-help/act-as-setup.txt index 8a369fe706e..96352b2c7b4 100644 --- a/doc/cmd-v2-hidden-help/act-as-setup.txt +++ b/doc/cmd-v2-hidden-help/act-as-setup.txt @@ -4,4 +4,5 @@ Usage: cabal act-as-setup Flags for act-as-setup: -h, --help # Show this help text - --build-type=BUILD-TYPE # Use the given build type. + --build-type=Simple|Configure + # Use the given build type. diff --git a/doc/setup-help/configure.txt b/doc/setup-help/configure.txt index a5b3587cdd3..2039e080640 100644 --- a/doc/setup-help/configure.txt +++ b/doc/setup-help/configure.txt @@ -41,29 +41,24 @@ Flags for configure: --sysconfdir=DIR # Installation directory for configuration files --program-prefix=PREFIX # Prefix to be applied to installed executables --program-suffix=SUFFIX # Suffix to be applied to installed executables - --enable-library-vanilla # Enable Vanilla libraries - --disable-library-vanilla # Disable Vanilla libraries + --[enable|disable]-library-vanilla + # Toggle Vanilla libraries -p, --enable-library-profiling # Enable Library profiling --disable-library-profiling # Disable Library profiling - --enable-shared # Enable Shared library - --disable-shared # Disable Shared library - --enable-static # Enable Static library - --disable-static # Disable Static library - --enable-library-bytecode # Enable Bytecode library - --disable-library-bytecode # Disable Bytecode library - --enable-executable-dynamic # Enable Executable dynamic linking - --disable-executable-dynamic # Disable Executable dynamic linking - --enable-executable-static # Enable Executable fully static linking - --disable-executable-static # Disable Executable fully static linking - --enable-profiling # Enable Executable and library profiling - --disable-profiling # Disable Executable and library profiling - --enable-profiling-shared # Enable Build profiling shared libraries - --disable-profiling-shared # Disable Build profiling shared libraries - --enable-executable-profiling - # Enable Executable profiling (DEPRECATED) - --disable-executable-profiling - # Disable Executable profiling (DEPRECATED) + --[enable|disable]-shared # Toggle Shared library + --[enable|disable]-static # Toggle Static library + --[enable|disable]-library-bytecode + # Toggle Bytecode library + --[enable|disable]-executable-dynamic + # Toggle Executable dynamic linking + --[enable|disable]-executable-static + # Toggle Executable fully static linking + --[enable|disable]-profiling # Toggle Executable and library profiling + --[enable|disable]-profiling-shared + # Toggle Build profiling shared libraries + --[enable|disable]-executable-profiling + # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and library (default, none, exported-functions, toplevel-functions, all-functions, late). @@ -79,27 +74,20 @@ Flags for configure: project building --disable-build-info # Disable build information generation during project building - --enable-library-for-ghci # Enable compile library for use with GHCi - --disable-library-for-ghci # Disable compile library for use with GHCi - --enable-split-sections # Enable compile library code such that unneeded + --[enable|disable]-library-for-ghci + # Toggle compile library for use with GHCi + --[enable|disable]-split-sections + # Toggle compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+) - --disable-split-sections # Disable compile library code such that - unneeded definitions can be dropped from the - final executable (GHC 7.8+) - --enable-split-objs # Enable split library into smaller objects to + --[enable|disable]-split-objs + # Toggle split library into smaller objects to reduce binary sizes (GHC 6.6+) - --disable-split-objs # Disable split library into smaller objects to - reduce binary sizes (GHC 6.6+) - --enable-executable-stripping - # Enable strip executables upon installation to - reduce binary sizes - --disable-executable-stripping - # Disable strip executables upon installation to - reduce binary sizes - --enable-library-stripping # Enable strip libraries upon installation to + --[enable|disable]-executable-stripping + # Toggle strip executables upon installation to reduce binary sizes - --disable-library-stripping # Disable strip libraries upon installation to + --[enable|disable]-library-stripping + # Toggle strip libraries upon installation to reduce binary sizes --configure-option=OPT # Extra option for configure --user # Enable doing a per-user installation @@ -120,9 +108,8 @@ Flags for configure: false. --extra-include-dirs=PATH # A list of directories to search for header files - --enable-deterministic # Enable Try to be as deterministic as possible - (used by the test suite) - --disable-deterministic # Disable Try to be as deterministic as possible + --[enable|disable]-deterministic + # Toggle Try to be as deterministic as possible (used by the test suite) --ipid=IPID # Installed package ID to compile this package as @@ -148,32 +135,23 @@ Flags for configure: --promised-dependency="void-0.5.8=void-0.5.8-177d5cdf20962d0581fe2e4932a6c309" --instantiate-with=NAME=MOD # A mapping of signature names to concrete module instantiations. - --enable-tests # Enable dependency checking and compilation for + --[enable|disable]-tests # Toggle dependency checking and compilation for test suites listed in the package description file. - --disable-tests # Disable dependency checking and compilation - for test suites listed in the package - description file. - --enable-coverage # Enable build package with Haskell Program - Coverage. (GHC only) - --disable-coverage # Disable build package with Haskell Program + --[enable|disable]-coverage # Toggle build package with Haskell Program Coverage. (GHC only) - --enable-library-coverage # Enable build package with Haskell Program - Coverage. (GHC only) (DEPRECATED) - --disable-library-coverage # Disable build package with Haskell Program + --[enable|disable]-library-coverage + # Toggle build package with Haskell Program Coverage. (GHC only) (DEPRECATED) --exact-configuration # All direct dependencies and flags are provided on the command line. - --enable-benchmarks # Enable dependency checking and compilation for + --[enable|disable]-benchmarks + # Toggle dependency checking and compilation for benchmarks listed in the package description file. - --disable-benchmarks # Disable dependency checking and compilation - for benchmarks listed in the package - description file. - --enable-relocatable # Enable building a package that is relocatable. + --[enable|disable]-relocatable + # Toggle building a package that is relocatable. (GHC only) - --disable-relocatable # Disable building a package that is - relocatable. (GHC only) --disable-response-files # Enable workaround for old versions of programs like "ar" that do not support @file arguments --allow-depending-on-private-libs diff --git a/doc/setup-help/install.txt b/doc/setup-help/install.txt index 4aa64d05a4f..1cec92d8c76 100644 --- a/doc/setup-help/install.txt +++ b/doc/setup-help/install.txt @@ -17,9 +17,8 @@ Flags for install: --inplace # install the package in the install subdirectory of the dist prefix, so it can be used without being installed - --enable-shell-wrappers # Enable using shell script wrappers around - executables - --disable-shell-wrappers # Disable using shell script wrappers around + --[enable|disable]-shell-wrappers + # Toggle using shell script wrappers around executables --user # upon configuration register this package in the user's local package database diff --git a/doc/setup-help/test.txt b/doc/setup-help/test.txt index 3ebe170302e..65a469c1747 100644 --- a/doc/setup-help/test.txt +++ b/doc/setup-help/test.txt @@ -25,12 +25,13 @@ Flags for test: --machine-log=TEMPLATE # Produce a machine-readable log file (name template can use $pkgid, $compiler, $os, $arch, $result) - --show-details=FILTER # 'always': always show results of individual - test cases. 'never': never show results of - individual test cases. 'failures': show - results of failing test cases. 'streaming': - show results of test cases in real - time.'direct': send results of test cases in + --show-details=always|never|failures|streaming|direct + # Allowed values: - always: always show results + of individual test cases, - never: never show + results of individual test cases, - failures: + show results of failing test cases, - + streaming: show results of test cases in real + time, - direct: send results of test cases in real time; no log file. --keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. From fec0b6749ad2c0bcc66c45d5f7623fe1490af4f1 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 12:44:38 -0400 Subject: [PATCH 099/104] Indent help description list items --- Cabal/src/Distribution/GetOpt.hs | 41 +++++++++++++------ .../src/Distribution/Client/Cmd/UI.hs | 16 +++++++- .../src/Distribution/Client/Setup.hs | 4 +- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/Cabal/src/Distribution/GetOpt.hs b/Cabal/src/Distribution/GetOpt.hs index 25c980a28ba..a6b5f71e5d7 100644 --- a/Cabal/src/Distribution/GetOpt.hs +++ b/Cabal/src/Distribution/GetOpt.hs @@ -38,6 +38,8 @@ module Distribution.GetOpt import Distribution.Compat.Prelude import Prelude () +import Data.List (stripPrefix) + -- | What to do with options following non-options data ArgOrder a = -- | no option processing after first non-option @@ -170,21 +172,36 @@ fmtLong (OptArg _ ad) lo = let opt = "--" ++ lo in opt ++ "[=" ++ ad ++ "]" +-- | Wrap text to the given width. Each line of the input is wrapped on its +-- own, so a description written with explicit line breaks, such as a list of +-- allowed values, keeps those breaks. A line that starts with a @- @ list +-- marker gets a hanging indent, so its continuation lines align with the text +-- after the marker. wrapText :: Int -> String -> [String] -wrapText width = map unwords . wrap 0 [] . words +wrapText width = concatMap wrapLine . lines where - wrap :: Int -> [String] -> [String] -> [[String]] - wrap 0 [] (w : ws) - | length w + 1 > width = - wrap (length w) [w] ws - wrap col line (w : ws) - | col + length w + 1 > width = - reverse line : wrap 0 [] (w : ws) - wrap col line (w : ws) = + wrapLine line = case stripPrefix listMarker line of + Just item -> + zipWith (++) (listMarker : repeat listIndent) (wrapWords (width - length listMarker) item) + Nothing -> wrapWords width line + + listMarker = "- " + listIndent = map (const ' ') listMarker + + wrapWords w = map unwords . wrap w 0 [] . words + + wrap :: Int -> Int -> [String] -> [String] -> [[String]] + wrap width' 0 [] (w : ws) + | length w + 1 > width' = + wrap width' (length w) [w] ws + wrap width' col line (w : ws) + | col + length w + 1 > width' = + reverse line : wrap width' 0 [] (w : ws) + wrap width' col line (w : ws) = let col' = col + length w + 1 - in wrap col' (w : line) ws - wrap _ [] [] = [] - wrap _ line [] = [reverse line] + in wrap width' col' (w : line) ws + wrap _ _ [] [] = [] + wrap _ _ line [] = [reverse line] -- | -- Process the command-line, and return the list of values that matched diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index 8a47634f573..acc131df991 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -508,13 +508,25 @@ renderOptionRows colorizeWarning maxFlagColumnWidth descColumn helpOutputWidth o <> "\n" <> concat [descriptionIndent <> markerPadding <> line <> "\n" | line <- continuation] +-- | Wrap a description to the given width, one paragraph per input line. A +-- paragraph that starts with a @- @ list marker gets a hanging indent, so its +-- continuation lines align with the text after the marker. wrapDescription :: Int -> String -> [String] wrapDescription width description = case concatMap wrapParagraph (lines description) of [] -> [""] wrapped -> wrapped where - wrapParagraph paragraph + wrapParagraph paragraph = + case stripPrefix listMarker paragraph of + Just item -> + zipWith (<>) (listMarker : repeat listIndent) (wrapWords (width - length listMarker) item) + Nothing -> wrapWords width paragraph + + listMarker = "- " + listIndent = map (const ' ') listMarker + + wrapWords w paragraph | null ws = [""] | otherwise = reverse (foldl' step [""] ws) where @@ -522,7 +534,7 @@ wrapDescription width description = step (current : previous) word | null current = word : previous - | length current + 1 + length word <= width = (current <> " " <> word) : previous + | length current + 1 + length word <= w = (current <> " " <> word) : previous | otherwise = word : current : previous step [] _ = [] diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index 70d521844d5..15c591f02fa 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -3030,8 +3030,8 @@ initOptions _ = [ option ['i'] ["interactive"] - ( "Interactive mode. Creates a prompt tree for project creation. \n" - ++ "If -n/--non-interactive is issued, a simple project with inferred defaults \n" + ( "Interactive mode. Creates a prompt tree for project creation. " + ++ "If -n/--non-interactive is issued, a simple project with inferred defaults " ++ "is created. If --simple is issued, then sensible defaults will be chosen as well." ) IT.interactive From 77c4b345bca77b6da42d4233a1d3e60bf0916ca1 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 12:57:41 -0400 Subject: [PATCH 100/104] Show help description list items --- Cabal/src/Distribution/Simple/Setup/Config.hs | 20 ++++++++--- .../src/Distribution/Client/Setup.hs | 34 +++++++++++++------ 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Setup/Config.hs b/Cabal/src/Distribution/Simple/Setup/Config.hs index 40bcd24b46c..de781ec7dd6 100644 --- a/Cabal/src/Distribution/Simple/Setup/Config.hs +++ b/Cabal/src/Distribution/Simple/Setup/Config.hs @@ -542,9 +542,7 @@ configureOptions showOrParseArgs = , option "" ["profiling-detail"] - ( "Profiling detail level for executable and library (default, " - ++ "none, exported-functions, toplevel-functions, all-functions, late)." - ) + ("Profiling detail level for executable and library.\n" ++ profDetailLevelsHelp) configProfDetail (\v flags -> flags{configProfDetail = v}) ( reqArg' @@ -555,7 +553,7 @@ configureOptions showOrParseArgs = , option "" ["library-profiling-detail"] - "Profiling detail level for libraries only." + ("Profiling detail level for libraries only.\n" ++ profDetailLevelsHelp) configProfLibDetail (\v flags -> flags{configProfLibDetail = v}) ( reqArg' @@ -912,6 +910,20 @@ showProfDetailLevelFlag :: Flag ProfDetailLevel -> [String] showProfDetailLevelFlag NoFlag = [] showProfDetailLevelFlag (Flag dl) = [showProfDetailLevel dl] +-- | Help text listing the known profiling detail levels, one per line with +-- any aliases, so that the option descriptions stay in step with +-- 'knownProfDetailLevels'. +profDetailLevelsHelp :: String +profDetailLevelsHelp = + unlines ("Allowed values:" : punctuate [item primary aliases | (primary, aliases, _) <- knownProfDetailLevels]) + where + item primary [] = "- " ++ primary + item primary aliases = "- " ++ primary ++ " (or " ++ intercalate ", " aliases ++ ")" + + punctuate [] = [] + punctuate [x] = [x ++ "."] + punctuate (x : xs) = (x ++ ",") : punctuate xs + parsecPromisedComponent :: ParsecParser PromisedComponent parsecPromisedComponent = do pn <- parsec diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index 15c591f02fa..b878c0629e7 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -524,10 +524,10 @@ globalCommand commands = , option [] ["http-transport"] - "Set a transport for http(s) requests. Accepts 'curl', 'wget', 'powershell', and 'plain-http'. (default: 'curl')" + "Set a transport for http(s) requests (default: curl)." globalHttpTransport (\v flags -> flags{globalHttpTransport = v}) - (reqArgFlag "HttpTransport") + (reqArgFlag "curl|wget|powershell|plain-http") , option [] ["store-dir", "storedir"] @@ -1955,11 +1955,14 @@ getCommand = , option [] ["index-state"] - ( "Use source package index state as it existed at a previous time. " - ++ "Accepts unix-timestamps (e.g. '@1474732068'), ISO8601 UTC timestamps " - ++ "(e.g. '2016-09-24T17:47:48Z'), or 'HEAD' (default: 'HEAD'). " - ++ "This determines which package versions are available as well as " - ++ ".cabal file revision is selected (unless --pristine is used)." + ( unlines + [ "Use source package index state as it existed at a previous time. Accepts:" + , "- a unix timestamp, e.g. '@1474732068'," + , "- an ISO8601 UTC timestamp, e.g. '2016-09-24T17:47:48Z'," + , "- 'HEAD', the default." + , "This determines which package versions are available as well as " + ++ ".cabal file revision is selected (unless --pristine is used)." + ] ) getIndexState (\v flags -> flags{getIndexState = v}) @@ -2685,9 +2688,12 @@ installOptions showOrParseArgs = , option [] ["index-state"] - ( "Use source package index state as it existed at a previous time. " - ++ "Accepts unix-timestamps (e.g. '@1474732068'), ISO8601 UTC timestamps " - ++ "(e.g. '2016-09-24T17:47:48Z'), or 'HEAD' (default: 'HEAD')." + ( unlines + [ "Use source package index state as it existed at a previous time. Accepts:" + , "- a unix timestamp, e.g. '@1474732068'," + , "- an ISO8601 UTC timestamp, e.g. '2016-09-24T17:47:48Z'," + , "- 'HEAD', the default." + ] ) installIndexState (\v flags -> flags{installIndexState = v}) @@ -3700,7 +3706,13 @@ optionSolverFlags , option [] ["prefer-version"] - "Select which version of a package that the solver should prefer. Oldest is useful to determine lower bounds in build-depends section. Latest will prefer the latest version. Installed-or-latest will prefer installed versions and the latest version otherwise." + ( unlines + [ "Select which version of a package that the solver should prefer:" + , "- oldest: useful to determine lower bounds in the build-depends section," + , "- latest: prefer the latest version," + , "- installed-or-latest: prefer installed versions and the latest version otherwise." + ] + ) getpo setpo ( reqArg From 20c5e3d45cd79254103059fb2c2d011d49b2f57e Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 12:58:06 -0400 Subject: [PATCH 101/104] Regenerate doc/cmd-*/*.txt --- doc/cmd-v1-help/configure.txt | 17 +++++++-- doc/cmd-v1-help/freeze.txt | 12 +++---- doc/cmd-v1-help/install.txt | 64 +++++++++++++++++++++------------ doc/cmd-v1-help/reconfigure.txt | 17 +++++++-- doc/cmd-v1-help/test.txt | 18 ++++++---- doc/cmd-v2-help/bench.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/build.txt | 50 ++++++++++++++++---------- doc/cmd-v2-help/configure.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/exec.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/fetch.txt | 12 +++---- doc/cmd-v2-help/freeze.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/gen-bounds.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/get.txt | 15 ++++---- doc/cmd-v2-help/haddock.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/help.txt | 7 ++-- doc/cmd-v2-help/install.txt | 50 ++++++++++++++++---------- doc/cmd-v2-help/list-bin.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/outdated.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/path.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/repl.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/run.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/target.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/test.txt | 64 +++++++++++++++++++++------------ doc/cmd-v2-help/unpack.txt | 15 ++++---- doc/cmd-v2-help/update.txt | 64 +++++++++++++++++++++------------ doc/setup-help/configure.txt | 17 +++++++-- doc/setup-help/test.txt | 18 ++++++---- 27 files changed, 792 insertions(+), 416 deletions(-) diff --git a/doc/cmd-v1-help/configure.txt b/doc/cmd-v1-help/configure.txt index 71c2c70720b..dea830c8b9f 100644 --- a/doc/cmd-v1-help/configure.txt +++ b/doc/cmd-v1-help/configure.txt @@ -60,10 +60,23 @@ Flags for v1-configure: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) diff --git a/doc/cmd-v1-help/freeze.txt b/doc/cmd-v1-help/freeze.txt index 3e965fb8e01..bac680cc6c5 100644 --- a/doc/cmd-v1-help/freeze.txt +++ b/doc/cmd-v1-help/freeze.txt @@ -52,12 +52,12 @@ Flags for v1-freeze: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. diff --git a/doc/cmd-v1-help/install.txt b/doc/cmd-v1-help/install.txt index 5e1277014b1..dd50fa62976 100644 --- a/doc/cmd-v1-help/install.txt +++ b/doc/cmd-v1-help/install.txt @@ -71,10 +71,23 @@ Flags for v1-install: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -225,12 +238,12 @@ Flags for v1-install: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -257,10 +270,11 @@ Flags for v1-install: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --symlink-bindir=DIR # Add symlinks to installed executables into this directory. @@ -270,9 +284,11 @@ Flags for v1-install: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -321,13 +337,17 @@ Flags for v1-install: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v1-help/reconfigure.txt b/doc/cmd-v1-help/reconfigure.txt index a0a38ada0fe..8985ae78414 100644 --- a/doc/cmd-v1-help/reconfigure.txt +++ b/doc/cmd-v1-help/reconfigure.txt @@ -59,10 +59,23 @@ Flags for v1-reconfigure: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) diff --git a/doc/cmd-v1-help/test.txt b/doc/cmd-v1-help/test.txt index 2c694bdcb73..2c1e85409e3 100644 --- a/doc/cmd-v1-help/test.txt +++ b/doc/cmd-v1-help/test.txt @@ -43,13 +43,17 @@ Flags for v1-test: template can use $pkgid, $compiler, $os, $arch, $result) --show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --fail-when-no-test-suites # Exit with failure when no test suites are diff --git a/doc/cmd-v2-help/bench.txt b/doc/cmd-v2-help/bench.txt index aeb5ceb2cdb..13a2c0b5ac0 100644 --- a/doc/cmd-v2-help/bench.txt +++ b/doc/cmd-v2-help/bench.txt @@ -64,10 +64,23 @@ Flags for bench: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -218,12 +231,12 @@ Flags for bench: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -250,10 +263,11 @@ Flags for bench: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -261,9 +275,11 @@ Flags for bench: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -312,13 +328,17 @@ Flags for bench: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/build.txt b/doc/cmd-v2-help/build.txt index 1b8eafb2770..9e5f953a621 100644 --- a/doc/cmd-v2-help/build.txt +++ b/doc/cmd-v2-help/build.txt @@ -44,12 +44,12 @@ Flags for build: --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --strong-flags # Do not defer flag choices (this used to be the default in cabal-install <= 1.20). --project-file=FILE # Set the path of the cabal.project file @@ -128,15 +128,15 @@ Test options: --test-show-details=always|never|failures|streaming|direct # Allowed values: - always: always show results of individual - test cases, + test cases, - never: never show results of individual test - cases, + cases, - failures: show results of failing test - cases, + cases, - streaming: show results of test cases in - real time, + real time, - direct: send results of test cases in real - time; no log file. + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. @@ -180,11 +180,24 @@ Profiling options: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). Dependency solving options: --allow-depending-on-private-libs @@ -239,10 +252,11 @@ Dependency solving options: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. Executable build options: --[enable|disable]-executable-dynamic @@ -362,7 +376,7 @@ Logging and reporting options: server: - none: do not report, - anonymous: report without identifying - information, + information, - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage diff --git a/doc/cmd-v2-help/configure.txt b/doc/cmd-v2-help/configure.txt index b389faab3a9..583fb24bf8d 100644 --- a/doc/cmd-v2-help/configure.txt +++ b/doc/cmd-v2-help/configure.txt @@ -77,10 +77,23 @@ Flags for configure: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -231,12 +244,12 @@ Flags for configure: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -263,10 +276,11 @@ Flags for configure: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -274,9 +288,11 @@ Flags for configure: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -325,13 +341,17 @@ Flags for configure: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/exec.txt b/doc/cmd-v2-help/exec.txt index 6ea13b19414..631207aa0cb 100644 --- a/doc/cmd-v2-help/exec.txt +++ b/doc/cmd-v2-help/exec.txt @@ -66,10 +66,23 @@ Flags for exec: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -220,12 +233,12 @@ Flags for exec: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -252,10 +265,11 @@ Flags for exec: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -263,9 +277,11 @@ Flags for exec: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -314,13 +330,17 @@ Flags for exec: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/fetch.txt b/doc/cmd-v2-help/fetch.txt index a986883b91b..1143a7d4b0a 100644 --- a/doc/cmd-v2-help/fetch.txt +++ b/doc/cmd-v2-help/fetch.txt @@ -50,12 +50,12 @@ Flags for fetch: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. diff --git a/doc/cmd-v2-help/freeze.txt b/doc/cmd-v2-help/freeze.txt index e9c0f1ce67c..6c24c8c411f 100644 --- a/doc/cmd-v2-help/freeze.txt +++ b/doc/cmd-v2-help/freeze.txt @@ -69,10 +69,23 @@ Flags for freeze: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -223,12 +236,12 @@ Flags for freeze: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -255,10 +268,11 @@ Flags for freeze: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -266,9 +280,11 @@ Flags for freeze: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -317,13 +333,17 @@ Flags for freeze: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/gen-bounds.txt b/doc/cmd-v2-help/gen-bounds.txt index 1f9fb8003b5..3aabfa33349 100644 --- a/doc/cmd-v2-help/gen-bounds.txt +++ b/doc/cmd-v2-help/gen-bounds.txt @@ -55,10 +55,23 @@ Flags for gen-bounds: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -209,12 +222,12 @@ Flags for gen-bounds: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -241,10 +254,11 @@ Flags for gen-bounds: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -252,9 +266,11 @@ Flags for gen-bounds: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -303,13 +319,17 @@ Flags for gen-bounds: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/get.txt b/doc/cmd-v2-help/get.txt index 8f4331e5cf4..f90e5de9c21 100644 --- a/doc/cmd-v2-help/get.txt +++ b/doc/cmd-v2-help/get.txt @@ -17,13 +17,14 @@ Flags for get: # Copy the package's source repository (ie git clone, darcs get, etc as appropriate). --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). This determines which - package versions are available as well as - .cabal file revision is selected (unless - --pristine is used). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. + This determines which package versions are + available as well as .cabal file revision is + selected (unless --pristine is used). --only-package-description # Unpack only the package description file. --package-description-only # A synonym for --only-package-description. --pristine # Unpack the original pristine tarball, rather diff --git a/doc/cmd-v2-help/haddock.txt b/doc/cmd-v2-help/haddock.txt index fc8b2001e6c..59182dfdb63 100644 --- a/doc/cmd-v2-help/haddock.txt +++ b/doc/cmd-v2-help/haddock.txt @@ -69,10 +69,23 @@ Flags for haddock: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -223,12 +236,12 @@ Flags for haddock: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -255,10 +268,11 @@ Flags for haddock: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -266,9 +280,11 @@ Flags for haddock: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -317,13 +333,17 @@ Flags for haddock: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/help.txt b/doc/cmd-v2-help/help.txt index dba7ffe6948..f4044a696c5 100644 --- a/doc/cmd-v2-help/help.txt +++ b/doc/cmd-v2-help/help.txt @@ -105,10 +105,9 @@ Global flags: --config-file=FILE # Set an alternate location for the config file --ignore-expiry # Ignore expiry dates on signed metadata (use only in exceptional circumstances) - --http-transport=HttpTransport - # Set a transport for http(s) requests. Accepts - 'curl', 'wget', 'powershell', and - 'plain-http'. (default: 'curl') + --http-transport=curl|wget|powershell|plain-http + # Set a transport for http(s) requests (default: + curl). --store-dir=DIR # The location of the build store --active-repositories=REPOS # The active package repositories (set to ':none' to disable all repositories) diff --git a/doc/cmd-v2-help/install.txt b/doc/cmd-v2-help/install.txt index 90e7c57da03..0d1d4edf058 100644 --- a/doc/cmd-v2-help/install.txt +++ b/doc/cmd-v2-help/install.txt @@ -45,12 +45,12 @@ Flags for install: --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --strong-flags # Do not defer flag choices (this used to be the default in cabal-install <= 1.20). --project-file=FILE # Set the path of the cabal.project file @@ -139,15 +139,15 @@ Test options: --test-show-details=always|never|failures|streaming|direct # Allowed values: - always: always show results of individual - test cases, + test cases, - never: never show results of individual test - cases, + cases, - failures: show results of failing test - cases, + cases, - streaming: show results of test cases in - real time, + real time, - direct: send results of test cases in real - time; no log file. + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. @@ -191,11 +191,24 @@ Profiling options: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). Dependency solving options: --allow-depending-on-private-libs @@ -250,10 +263,11 @@ Dependency solving options: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. Executable build options: --[enable|disable]-executable-dynamic @@ -371,7 +385,7 @@ Logging and reporting options: server: - none: do not report, - anonymous: report without identifying - information, + information, - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage diff --git a/doc/cmd-v2-help/list-bin.txt b/doc/cmd-v2-help/list-bin.txt index 27703698672..8bcec28f4ef 100644 --- a/doc/cmd-v2-help/list-bin.txt +++ b/doc/cmd-v2-help/list-bin.txt @@ -56,10 +56,23 @@ Flags for list-bin: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -210,12 +223,12 @@ Flags for list-bin: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -242,10 +255,11 @@ Flags for list-bin: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -253,9 +267,11 @@ Flags for list-bin: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -304,13 +320,17 @@ Flags for list-bin: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/outdated.txt b/doc/cmd-v2-help/outdated.txt index 75fce9fdb63..8e67dde02aa 100644 --- a/doc/cmd-v2-help/outdated.txt +++ b/doc/cmd-v2-help/outdated.txt @@ -57,10 +57,23 @@ Flags for outdated: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -211,12 +224,12 @@ Flags for outdated: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -243,10 +256,11 @@ Flags for outdated: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -254,9 +268,11 @@ Flags for outdated: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -305,13 +321,17 @@ Flags for outdated: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/path.txt b/doc/cmd-v2-help/path.txt index 18f9359ab65..47bd6156ccf 100644 --- a/doc/cmd-v2-help/path.txt +++ b/doc/cmd-v2-help/path.txt @@ -58,10 +58,23 @@ Flags for path: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -212,12 +225,12 @@ Flags for path: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -244,10 +257,11 @@ Flags for path: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -255,9 +269,11 @@ Flags for path: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -306,13 +322,17 @@ Flags for path: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/repl.txt b/doc/cmd-v2-help/repl.txt index c8f1f42a703..0e37b24f047 100644 --- a/doc/cmd-v2-help/repl.txt +++ b/doc/cmd-v2-help/repl.txt @@ -67,10 +67,23 @@ Flags for repl: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -221,12 +234,12 @@ Flags for repl: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -253,10 +266,11 @@ Flags for repl: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -264,9 +278,11 @@ Flags for repl: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -315,13 +331,17 @@ Flags for repl: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/run.txt b/doc/cmd-v2-help/run.txt index 1b4da5724a4..e66fff36895 100644 --- a/doc/cmd-v2-help/run.txt +++ b/doc/cmd-v2-help/run.txt @@ -70,10 +70,23 @@ Flags for run: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -224,12 +237,12 @@ Flags for run: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -256,10 +269,11 @@ Flags for run: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -267,9 +281,11 @@ Flags for run: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -318,13 +334,17 @@ Flags for run: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/target.txt b/doc/cmd-v2-help/target.txt index 89574d3bd84..a7fe5175746 100644 --- a/doc/cmd-v2-help/target.txt +++ b/doc/cmd-v2-help/target.txt @@ -86,10 +86,23 @@ Flags for target: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -240,12 +253,12 @@ Flags for target: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -272,10 +285,11 @@ Flags for target: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -283,9 +297,11 @@ Flags for target: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -334,13 +350,17 @@ Flags for target: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/test.txt b/doc/cmd-v2-help/test.txt index c80741943bc..6bb158db666 100644 --- a/doc/cmd-v2-help/test.txt +++ b/doc/cmd-v2-help/test.txt @@ -66,10 +66,23 @@ Flags for test: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -220,12 +233,12 @@ Flags for test: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -252,10 +265,11 @@ Flags for test: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -263,9 +277,11 @@ Flags for test: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -314,13 +330,17 @@ Flags for test: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/cmd-v2-help/unpack.txt b/doc/cmd-v2-help/unpack.txt index 415b4eb007d..d7e9e291bec 100644 --- a/doc/cmd-v2-help/unpack.txt +++ b/doc/cmd-v2-help/unpack.txt @@ -17,13 +17,14 @@ Flags for unpack: # Copy the package's source repository (ie git clone, darcs get, etc as appropriate). --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). This determines which - package versions are available as well as - .cabal file revision is selected (unless - --pristine is used). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. + This determines which package versions are + available as well as .cabal file revision is + selected (unless --pristine is used). --only-package-description # Unpack only the package description file. --package-description-only # A synonym for --only-package-description. --pristine # Unpack the original pristine tarball, rather diff --git a/doc/cmd-v2-help/update.txt b/doc/cmd-v2-help/update.txt index ac629a1e4f9..469912962c2 100644 --- a/doc/cmd-v2-help/update.txt +++ b/doc/cmd-v2-help/update.txt @@ -56,10 +56,23 @@ Flags for update: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) @@ -210,12 +223,12 @@ Flags for update: section. --prefer-version=oldest|latest|installed-or-latest # Select which version of a package that the - solver should prefer. Oldest is useful to - determine lower bounds in build-depends - section. Latest will prefer the latest - version. Installed-or-latest will prefer - installed versions and the latest version - otherwise. + solver should prefer: + - oldest: useful to determine lower bounds in + the build-depends section, + - latest: prefer the latest version, + - installed-or-latest: prefer installed + versions and the latest version otherwise. --shadow-installed-packages # If multiple package instances of the same version are installed, treat all but one as shadowed. @@ -242,10 +255,11 @@ Flags for update: build the given packages --dependencies-only # A synonym for --only-dependencies --index-state=STATE # Use source package index state as it existed - at a previous time. Accepts unix-timestamps - (e.g. '@1474732068'), ISO8601 UTC timestamps - (e.g. '2016-09-24T17:47:48Z'), or 'HEAD' - (default: 'HEAD'). + at a previous time. Accepts: + - a unix timestamp, e.g. '@1474732068', + - an ISO8601 UTC timestamp, e.g. + '2016-09-24T17:47:48Z', + - 'HEAD', the default. --root-cmd=COMMAND # (No longer supported, do not use.) --build-summary=TEMPLATE # Save build summaries to file (name template can use $pkgid, $compiler, $os, $arch) @@ -253,9 +267,11 @@ Flags for update: $pkgid, $compiler, $os, $arch) --remote-build-reporting=none|anonymous|detailed # Generate build reports to send to a remote - server: - none: do not report, - anonymous: - report without identifying information, - - detailed: report with full details. + server: + - none: do not report, + - anonymous: report without identifying + information, + - detailed: report with full details. --report-planning-failure # Generate build reports when the dependency solver fails. This is used by the Hackage build bot. @@ -304,13 +320,17 @@ Flags for update: template can use $pkgid, $compiler, $os, $arch, $result) --test-show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --test-keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --test-fail-when-no-test-suites diff --git a/doc/setup-help/configure.txt b/doc/setup-help/configure.txt index 2039e080640..ee0449a4687 100644 --- a/doc/setup-help/configure.txt +++ b/doc/setup-help/configure.txt @@ -60,10 +60,23 @@ Flags for configure: --[enable|disable]-executable-profiling # Toggle Executable profiling (DEPRECATED) --profiling-detail=level # Profiling detail level for executable and - library (default, none, exported-functions, - toplevel-functions, all-functions, late). + library. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). --library-profiling-detail=level # Profiling detail level for libraries only. + Allowed values: + - default, + - none, + - exported-functions (or exported), + - toplevel-functions (or toplevel, top), + - all-functions (or all), + - late-toplevel (or late). -O[n], --enable-optimization[=n] # Build with optimization (n is 0--2, default is 1) diff --git a/doc/setup-help/test.txt b/doc/setup-help/test.txt index 65a469c1747..7100bb87bae 100644 --- a/doc/setup-help/test.txt +++ b/doc/setup-help/test.txt @@ -26,13 +26,17 @@ Flags for test: template can use $pkgid, $compiler, $os, $arch, $result) --show-details=always|never|failures|streaming|direct - # Allowed values: - always: always show results - of individual test cases, - never: never show - results of individual test cases, - failures: - show results of failing test cases, - - streaming: show results of test cases in real - time, - direct: send results of test cases in - real time; no log file. + # Allowed values: + - always: always show results of individual + test cases, + - never: never show results of individual test + cases, + - failures: show results of failing test + cases, + - streaming: show results of test cases in + real time, + - direct: send results of test cases in real + time; no log file. --keep-tix-files # Keep .tix files for HPC between test runs --test-wrapper=FILE # Run test through a wrapper. --fail-when-no-test-suites # Exit with failure when no test suites are From 56174b7abea18efd116b7ef8d0d589095cbbc481 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 14:57:48 -0400 Subject: [PATCH 102/104] Bump the bootstrap versions for local items --- bootstrap/linux-9.10.3.json | 14 +++++++------- bootstrap/linux-9.12.4.json | 14 +++++++------- bootstrap/linux-9.6.7.json | 14 +++++++------- bootstrap/linux-9.8.4.json | 14 +++++++------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/bootstrap/linux-9.10.3.json b/bootstrap/linux-9.10.3.json index c1c2252a97d..46e358dd1a2 100644 --- a/bootstrap/linux-9.10.3.json +++ b/bootstrap/linux-9.10.3.json @@ -116,7 +116,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": "b74eed77eb3237c4ab6a39f08bcce4712b4486b091712ee20e92c8864f1e80a0", @@ -140,7 +140,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": null, @@ -150,7 +150,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18" + "version": "3.19" }, { "cabal_sha256": "39b25fd929b02b01a3fe59fec7ca8b2da6f0f9e282276b7a84e63a4702c4d725", @@ -356,7 +356,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": "0e9de2ccce261e7a5b027e842f6f47f50eb0e6059a0de98a5479f75aa8164107", @@ -477,7 +477,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "0.1" + "version": "3.19" }, { "cabal_sha256": "0dc8dc33b9bba0e025e444355f6c2d806f62a4656446961c3647165f80f0d278", @@ -612,7 +612,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": null, @@ -626,7 +626,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" } ] } diff --git a/bootstrap/linux-9.12.4.json b/bootstrap/linux-9.12.4.json index 8fd343f5f94..b737ceca0d5 100644 --- a/bootstrap/linux-9.12.4.json +++ b/bootstrap/linux-9.12.4.json @@ -120,7 +120,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": "b74eed77eb3237c4ab6a39f08bcce4712b4486b091712ee20e92c8864f1e80a0", @@ -144,7 +144,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": null, @@ -154,7 +154,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18" + "version": "3.19" }, { "cabal_sha256": "39b25fd929b02b01a3fe59fec7ca8b2da6f0f9e282276b7a84e63a4702c4d725", @@ -360,7 +360,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": "0e9de2ccce261e7a5b027e842f6f47f50eb0e6059a0de98a5479f75aa8164107", @@ -468,7 +468,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "0.1" + "version": "3.19" }, { "cabal_sha256": "0dc8dc33b9bba0e025e444355f6c2d806f62a4656446961c3647165f80f0d278", @@ -603,7 +603,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": null, @@ -617,7 +617,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" } ] } diff --git a/bootstrap/linux-9.6.7.json b/bootstrap/linux-9.6.7.json index bd9320e9429..99b16caaca5 100644 --- a/bootstrap/linux-9.6.7.json +++ b/bootstrap/linux-9.6.7.json @@ -108,7 +108,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": "b74eed77eb3237c4ab6a39f08bcce4712b4486b091712ee20e92c8864f1e80a0", @@ -132,7 +132,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": null, @@ -142,7 +142,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18" + "version": "3.19" }, { "cabal_sha256": "39b25fd929b02b01a3fe59fec7ca8b2da6f0f9e282276b7a84e63a4702c4d725", @@ -358,7 +358,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": "0e9de2ccce261e7a5b027e842f6f47f50eb0e6059a0de98a5479f75aa8164107", @@ -479,7 +479,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "0.1" + "version": "3.19" }, { "cabal_sha256": "0dc8dc33b9bba0e025e444355f6c2d806f62a4656446961c3647165f80f0d278", @@ -614,7 +614,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": null, @@ -628,7 +628,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" } ] } diff --git a/bootstrap/linux-9.8.4.json b/bootstrap/linux-9.8.4.json index 569e9ac11b7..17b0e926116 100644 --- a/bootstrap/linux-9.8.4.json +++ b/bootstrap/linux-9.8.4.json @@ -108,7 +108,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": "b74eed77eb3237c4ab6a39f08bcce4712b4486b091712ee20e92c8864f1e80a0", @@ -132,7 +132,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": null, @@ -142,7 +142,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18" + "version": "3.19" }, { "cabal_sha256": "39b25fd929b02b01a3fe59fec7ca8b2da6f0f9e282276b7a84e63a4702c4d725", @@ -358,7 +358,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": "0e9de2ccce261e7a5b027e842f6f47f50eb0e6059a0de98a5479f75aa8164107", @@ -479,7 +479,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "0.1" + "version": "3.19" }, { "cabal_sha256": "0dc8dc33b9bba0e025e444355f6c2d806f62a4656446961c3647165f80f0d278", @@ -614,7 +614,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" }, { "cabal_sha256": null, @@ -628,7 +628,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.18.1.0" + "version": "3.19.0.0" } ] } From 208e94b60e98d43bd1e5ea600c4092b809d34efb Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 15:05:43 -0400 Subject: [PATCH 103/104] Undo compact layout of install layout group --- cabal-install/src/Distribution/Client/Cmd/UI.hs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Cmd/UI.hs b/cabal-install/src/Distribution/Client/Cmd/UI.hs index acc131df991..b091bf12827 100644 --- a/cabal-install/src/Distribution/Client/Cmd/UI.hs +++ b/cabal-install/src/Distribution/Client/Cmd/UI.hs @@ -89,7 +89,6 @@ import Distribution.Simple.Command , commandAddAction , commandParseArgs ) -import Distribution.Simple.Utils (ordNub) import Options.Applicative ( ParserInfo @@ -707,7 +706,6 @@ helpText helpColor replaceBuildAlias buildCommand invokedName pname = renderGroup :: HelpColor -> Int -> Int -> Int -> (OptionGroupKey, [OptionField a]) -> (String, [String]) renderGroup helpColor maxFlagColumnWidth descColumn helpOutputWidth (title, options) | null options = ("", []) - | title == InstallLayoutOptions = renderInstallLayoutGroupCompact helpColor helpOutputWidth options | otherwise = let (rows, warnings) = renderOptionRows @@ -723,20 +721,6 @@ renderGroup helpColor maxFlagColumnWidth descColumn helpOutputWidth (title, opti , warnings ) -renderInstallLayoutGroupCompact :: HelpColor -> Int -> [OptionField a] -> (String, [String]) -renderInstallLayoutGroupCompact helpColor helpOutputWidth options = - ( "\n" - <> colorizeHeader helpColor (show InstallLayoutOptions <> ":") - <> "\n" - <> concat [flagIndent <> line <> "\n" | line <- wrappedFlagLines] - , [] - ) - where - flagColumns = map (fst . getOptToColumns) (concatMap optionFieldToGetOpt options) - compactFlags = ordNub flagColumns - flagsLine = intercalate ", " compactFlags - wrappedFlagLines = wrapDescription (max 40 (helpOutputWidth - 2)) flagsLine - -- | Leading indent of each flag row. flagIndent :: String flagIndent = " " From 9f4bb097c8db428fe8b50972e7203ef6bc2c5085 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Thu, 8 Oct 2026 15:06:02 -0400 Subject: [PATCH 104/104] Regenerate doc/cmd-*/*.txt --- doc/cmd-v2-help/build.txt | 46 +++++++++++++++++++++++++++++++------ doc/cmd-v2-help/install.txt | 27 ++++++++++++++++++---- 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/doc/cmd-v2-help/build.txt b/doc/cmd-v2-help/build.txt index 9e5f953a621..5955c7fb42e 100644 --- a/doc/cmd-v2-help/build.txt +++ b/doc/cmd-v2-help/build.txt @@ -71,13 +71,45 @@ Unsupported options: --root-cmd=COMMAND # (No longer supported, do not use.) Install layout options: - --builddir=DIR, --prefix=DIR, --bindir=DIR, --libdir=DIR, --libsubdir=DIR, - --dynlibdir=DIR, --bytecodelibdir=DIR, --libexecdir=DIR, - --libexecsubdir=DIR, --datadir=DIR, --datasubdir=DIR, --docdir=DIR, - --htmldir=DIR, --haddockdir=DIR, --sysconfdir=DIR, --program-prefix=PREFIX, - --program-suffix=SUFFIX, --ipid=IPID, --cid=CID, --reinstall, - --avoid-reinstalls, --force-reinstalls, --run-tests, - --haddock-resources-dir=DIR, --haddock-output-dir=DIR, --project-dir=DIR + --builddir=DIR # The directory where Cabal puts generated build + files (default dist) + --prefix=DIR # Bake this prefix in preparation of + installation + --bindir=DIR # Installation directory for executables + --libdir=DIR # Installation directory for libraries + --libsubdir=DIR # Subdirectory of libdir in which libs are + installed + --dynlibdir=DIR # Installation directory for dynamic libraries + --bytecodelibdir=DIR # Installation directory for bytecode libraries + --libexecdir=DIR # Installation directory for program executables + --libexecsubdir=DIR # Subdirectory of libexecdir in which private + executables are installed + --datadir=DIR # Installation directory for read-only data + --datasubdir=DIR # Subdirectory of datadir in which data files + are installed + --docdir=DIR # Installation directory for documentation + --htmldir=DIR # Installation directory for HTML documentation + --haddockdir=DIR # Installation directory for haddock interfaces + --sysconfdir=DIR # Installation directory for configuration files + --program-prefix=PREFIX # Prefix to be applied to installed executables + --program-suffix=SUFFIX # Suffix to be applied to installed executables + --ipid=IPID # Installed package ID to compile this package + as + --cid=CID # Installed component ID to compile this + component as + --reinstall # Install even if it means installing the same + version again. + --avoid-reinstalls # Do not select versions that would + destructively overwrite installed packages. + --force-reinstalls # Reinstall packages even if they will most + likely break other installed packages. + --run-tests # Run package test suites during installation. + --haddock-resources-dir=DIR # Location of Haddocks static / auxiliary files + --haddock-output-dir=DIR # Generate haddock documentation into this + directory. This flag is provided as a + technology preview and is subject to change in + the next releases. + --project-dir=DIR # Set the path of the project directory Irrelevant options: --[enable|disable]-per-component diff --git a/doc/cmd-v2-help/install.txt b/doc/cmd-v2-help/install.txt index 0d1d4edf058..ec185361f04 100644 --- a/doc/cmd-v2-help/install.txt +++ b/doc/cmd-v2-help/install.txt @@ -85,10 +85,29 @@ Unsupported options: --root-cmd=COMMAND # (No longer supported, do not use.) Install layout options: - --builddir=DIR, --program-prefix=PREFIX, --program-suffix=SUFFIX, - --ipid=IPID, --cid=CID, --reinstall, --avoid-reinstalls, --force-reinstalls, - --run-tests, --haddock-resources-dir=DIR, --haddock-output-dir=DIR, - --project-dir=DIR, --installdir=DIR + --builddir=DIR # The directory where Cabal puts generated build + files (default dist) + --program-prefix=PREFIX # Prefix to be applied to installed executables + --program-suffix=SUFFIX # Suffix to be applied to installed executables + --ipid=IPID # Installed package ID to compile this package + as + --cid=CID # Installed component ID to compile this + component as + --reinstall # Install even if it means installing the same + version again. + --avoid-reinstalls # Do not select versions that would + destructively overwrite installed packages. + --force-reinstalls # Reinstall packages even if they will most + likely break other installed packages. + --run-tests # Run package test suites during installation. + --haddock-resources-dir=DIR # Location of Haddocks static / auxiliary files + --haddock-output-dir=DIR # Generate haddock documentation into this + directory. This flag is provided as a + technology preview and is subject to change in + the next releases. + --project-dir=DIR # Set the path of the project directory + --installdir=DIR # Where to install (by symlinking or copying) + the executables in. Irrelevant options: --[enable|disable]-per-component