diff --git a/cabal-install/Distribution/Client/Config.hs b/cabal-install/Distribution/Client/Config.hs index 59ae0ff36a626370f2ed12f3654f2767dbfa63e8..c3082fe1a8be372f1094eb74441ff579d4bafe18 100644 --- a/cabal-install/Distribution/Client/Config.hs +++ b/cabal-install/Distribution/Client/Config.hs @@ -822,7 +822,7 @@ commentSavedConfig = do globalRemoteRepos = toNubList [defaultRemoteRepo] }, savedInitFlags = mempty { - IT.interactive = toFlag True, + IT.interactive = toFlag False, IT.cabalVersion = toFlag (mkVersion [1,10]), IT.language = toFlag Haskell2010, IT.license = toFlag BSD3, diff --git a/cabal-install/Distribution/Client/Init.hs b/cabal-install/Distribution/Client/Init.hs index 980028c4a138d906b2bca8e6e88e87a5aae2af90..50e0a42f68f2e68a9864107e347309a1f816289c 100644 --- a/cabal-install/Distribution/Client/Init.hs +++ b/cabal-install/Distribution/Client/Init.hs @@ -696,8 +696,8 @@ eligibleForTestSuite flags = maybePrompt :: InitFlags -> IO t -> IO (Maybe t) maybePrompt flags p = case interactive flags of - Flag False -> return Nothing - _ -> Just `fmap` p + Flag True -> Just `fmap` p + _ -> return Nothing -- | Create a prompt with optional default value that returns a -- String. diff --git a/cabal-install/Distribution/Client/Setup.hs b/cabal-install/Distribution/Client/Setup.hs index eb5330d3d165764e452d362d3d23a95706c5bdfb..230c42ebd69baed1593b0d1768ff5e2e7075e60c 100644 --- a/cabal-install/Distribution/Client/Setup.hs +++ b/cabal-install/Distribution/Client/Setup.hs @@ -2230,17 +2230,17 @@ defaultInitFlags = emptyInitFlags { IT.initVerbosity = toFlag normal } initCommand :: CommandUI IT.InitFlags initCommand = CommandUI { commandName = "init", - commandSynopsis = "Create a new .cabal package file (interactively).", + commandSynopsis = "Create a new .cabal package file.", commandDescription = Just $ \_ -> wrapText $ - "Cabalise a project by creating a .cabal, Setup.hs, and " - ++ "optionally a LICENSE file.\n" + "Create a .cabal, Setup.hs, and optionally a LICENSE file.\n" ++ "\n" - ++ "Calling init with no arguments (recommended) uses an " - ++ "interactive mode, which will try to guess as much as " - ++ "possible and prompt you for the rest. Command-line " - ++ "arguments are provided for scripting purposes. " - ++ "If you don't want interactive mode, be sure to pass " - ++ "the -n flag.\n", + ++ "Calling init with no arguments creates an executable, " + ++ "guessing as many options as possible. The interactive " + ++ "mode can be invoked by the -i/--interactive flag, which " + ++ "will try to guess as much as possible and prompt you for " + ++ "the rest. You can change init to always be interactive by " + ++ "setting the interactive flag in your configuration file. " + ++ "Command-line arguments are provided for scripting purposes.\n", commandNotes = Nothing, commandUsage = \pname -> "Usage: " ++ pname ++ " init [FLAGS]\n", diff --git a/cabal-install/changelog b/cabal-install/changelog index 5508ceed48e4bc0dee8c58d1997e601f983bf192..8a939cec1779f3fb501455123cf67eec780c0952 100644 --- a/cabal-install/changelog +++ b/cabal-install/changelog @@ -39,6 +39,7 @@ that make it possible to copy the executable instead of symlinking it * --symlink-bindir no longer controls the symlinking directory of v2-install (installdir controls both symlinking and copying now) + * Default to non-interactive init. * Add --test-wrapper that allows a prebuild script to set the test environment. * Add filterTestFlags: filter test-wrapper for Cabal < 3.0.0. * Cabal now only builds the minimum of a package for `v2-install` (#5754, #6091)