From 93b8eedcb7c7279ca9cf1396d72548801d9f5001 Mon Sep 17 00:00:00 2001 From: Francesco Ariis Date: Sun, 3 Mar 2024 14:52:36 +0100 Subject: [PATCH 1/2] Fix typo Missing full stop. (cherry picked from commit 6bad26a2dfef9106dd2ef51f340e34486d53eea4) # Conflicts: # cabal-install/src/Distribution/Client/Setup.hs --- .../src/Distribution/Client/Setup.hs | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index 222b53b9967..8070e9f9dc7 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -3362,6 +3362,76 @@ userConfigCommand = -- ------------------------------------------------------------ +<<<<<<< HEAD +======= +-- * Dirs + +-- ------------------------------------------------------------ + +-- | A path that can be retrieved by the @cabal path@ command. +data Path + = PathCacheDir + | PathLogsDir + | PathStoreDir + | PathConfigFile + | PathInstallDir + deriving (Eq, Ord, Show, Enum, Bounded) + +-- | The configuration name for this path. +pathName :: Path -> String +pathName PathCacheDir = "cache-dir" +pathName PathLogsDir = "logs-dir" +pathName PathStoreDir = "store-dir" +pathName PathConfigFile = "config-file" +pathName PathInstallDir = "installdir" + +data PathFlags = PathFlags + { pathVerbosity :: Flag Verbosity + , pathDirs :: Flag [Path] + } + deriving (Generic) + +instance Monoid PathFlags where + mempty = + PathFlags + { pathVerbosity = toFlag normal + , pathDirs = toFlag [] + } + mappend = (<>) + +instance Semigroup PathFlags where + (<>) = gmappend + +pathCommand :: CommandUI PathFlags +pathCommand = + CommandUI + { commandName = "path" + , commandSynopsis = "Display paths used by cabal." + , commandDescription = Just $ \_ -> + wrapText $ + "This command prints the directories that are used by cabal," + ++ " taking into account the contents of the configuration file and any" + ++ " environment variables." + , commandNotes = Nothing + , commandUsage = \pname -> "Usage: " ++ pname ++ " path\n" + , commandDefaultFlags = mempty + , commandOptions = \_ -> + map pathOption [minBound .. maxBound] + ++ [optionVerbosity pathVerbosity (\v flags -> flags{pathVerbosity = v})] + } + where + pathOption s = + option + [] + [pathName s] + ("Print " <> pathName s) + pathDirs + (\v flags -> flags{pathDirs = Flag $ concat (flagToList (pathDirs flags) ++ flagToList v)}) + (noArg (Flag [s])) + +-- ------------------------------------------------------------ + +>>>>>>> 6bad26a2d (Fix typo) -- * GetOpt Utils -- ------------------------------------------------------------ From e9d9bdb956582bfd0e73bc2fe743ad8ade1f716d Mon Sep 17 00:00:00 2001 From: Artem Pelenitsyn Date: Mon, 13 May 2024 12:06:30 -0400 Subject: [PATCH 2/2] fix imaginary conflict --- cabal-install/src/Distribution/Client/Setup.hs | 3 --- 1 file changed, 3 deletions(-) diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index 8070e9f9dc7..9de6af990d5 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -3362,8 +3362,6 @@ userConfigCommand = -- ------------------------------------------------------------ -<<<<<<< HEAD -======= -- * Dirs -- ------------------------------------------------------------ @@ -3431,7 +3429,6 @@ pathCommand = -- ------------------------------------------------------------ ->>>>>>> 6bad26a2d (Fix typo) -- * GetOpt Utils -- ------------------------------------------------------------