Unverified Commit c5cfe272 authored by Oleg Grenrus's avatar Oleg Grenrus Committed by GitHub

Merge pull request #6661 from phadej/init-improvements

Improve `cabal init` code a bit
parents 79d28ceb 738a3337
...@@ -61,6 +61,7 @@ import Distribution.Client.BuildReports.Types ...@@ -61,6 +61,7 @@ import Distribution.Client.BuildReports.Types
( ReportLevel(..) ) ( ReportLevel(..) )
import qualified Distribution.Client.Init.Types as IT import qualified Distribution.Client.Init.Types as IT
( InitFlags(..) ) ( InitFlags(..) )
import qualified Distribution.Client.Init.Defaults as IT
import Distribution.Client.Setup import Distribution.Client.Setup
( GlobalFlags(..), globalCommand, defaultGlobalFlags ( GlobalFlags(..), globalCommand, defaultGlobalFlags
, ConfigExFlags(..), configureExOptions, defaultConfigExFlags , ConfigExFlags(..), configureExOptions, defaultConfigExFlags
...@@ -74,8 +75,6 @@ import Distribution.Client.CmdInstall.ClientInstallFlags ...@@ -74,8 +75,6 @@ import Distribution.Client.CmdInstall.ClientInstallFlags
import Distribution.Utils.NubList import Distribution.Utils.NubList
( NubList, fromNubList, toNubList, overNubList ) ( NubList, fromNubList, toNubList, overNubList )
import Distribution.License
( License(BSD3) )
import Distribution.Simple.Compiler import Distribution.Simple.Compiler
( DebugInfoLevel(..), OptimisationLevel(..) ) ( DebugInfoLevel(..), OptimisationLevel(..) )
import Distribution.Simple.Setup import Distribution.Simple.Setup
...@@ -114,8 +113,6 @@ import Distribution.Compiler ...@@ -114,8 +113,6 @@ import Distribution.Compiler
( CompilerFlavor(..), defaultCompilerFlavor ) ( CompilerFlavor(..), defaultCompilerFlavor )
import Distribution.Verbosity import Distribution.Verbosity
( Verbosity, normal ) ( Verbosity, normal )
import Distribution.Version
( mkVersion )
import Distribution.Solver.Types.ConstraintSource import Distribution.Solver.Types.ConstraintSource
...@@ -851,9 +848,9 @@ commentSavedConfig = do ...@@ -851,9 +848,9 @@ commentSavedConfig = do
}, },
savedInitFlags = mempty { savedInitFlags = mempty {
IT.interactive = toFlag False, IT.interactive = toFlag False,
IT.cabalVersion = toFlag (mkVersion [2,4]), IT.cabalVersion = toFlag IT.defaultCabalVersion,
IT.language = toFlag Haskell2010, IT.language = toFlag Haskell2010,
IT.license = toFlag BSD3, IT.license = NoFlag,
IT.sourceDirs = Nothing, IT.sourceDirs = Nothing,
IT.applicationDirs = Nothing IT.applicationDirs = Nothing
}, },
......
...@@ -31,8 +31,6 @@ import System.Directory ...@@ -31,8 +31,6 @@ import System.Directory
import System.FilePath import System.FilePath
( (</>), takeBaseName, equalFilePath ) ( (</>), takeBaseName, equalFilePath )
import Data.List
( (\\) )
import qualified Data.List.NonEmpty as NE import qualified Data.List.NonEmpty as NE
import Data.Function import Data.Function
( on ) ( on )
...@@ -43,8 +41,10 @@ import Control.Monad ...@@ -43,8 +41,10 @@ import Control.Monad
import Control.Arrow import Control.Arrow
( (&&&), (***) ) ( (&&&), (***) )
import Distribution.CabalSpecVersion
( CabalSpecVersion (..), showCabalSpecVersion )
import Distribution.Version import Distribution.Version
( Version, mkVersion, alterVersion, versionNumbers, majorBoundVersion ( Version, mkVersion, alterVersion, majorBoundVersion
, orLaterVersion, earlierVersion, intersectVersionRanges, VersionRange ) , orLaterVersion, earlierVersion, intersectVersionRanges, VersionRange )
import Distribution.Verbosity import Distribution.Verbosity
( Verbosity ) ( Verbosity )
...@@ -53,6 +53,7 @@ import Distribution.ModuleName ...@@ -53,6 +53,7 @@ import Distribution.ModuleName
import Distribution.InstalledPackageInfo import Distribution.InstalledPackageInfo
( InstalledPackageInfo, exposed ) ( InstalledPackageInfo, exposed )
import qualified Distribution.Package as P import qualified Distribution.Package as P
import qualified Distribution.SPDX as SPDX
import Distribution.Types.LibraryName import Distribution.Types.LibraryName
( LibraryName(..) ) ( LibraryName(..) )
import Language.Haskell.Extension ( Language(..) ) import Language.Haskell.Extension ( Language(..) )
...@@ -75,10 +76,6 @@ import Distribution.Client.Init.Heuristics ...@@ -75,10 +76,6 @@ import Distribution.Client.Init.Heuristics
SourceFileEntry(..), SourceFileEntry(..),
scanForModules, neededBuildPrograms ) scanForModules, neededBuildPrograms )
import Distribution.License
( License(..), knownLicenses, licenseToSPDX )
import qualified Distribution.SPDX as SPDX
import Distribution.Simple.Setup import Distribution.Simple.Setup
( Flag(..), flagToMaybe ) ( Flag(..), flagToMaybe )
import Distribution.Simple.Configure import Distribution.Simple.Configure
...@@ -123,8 +120,8 @@ initCabal verbosity packageDBs repoCtxt comp progdb initFlags = do ...@@ -123,8 +120,8 @@ initCabal verbosity packageDBs repoCtxt comp progdb initFlags = do
initFlags' <- extendFlags installedPkgIndex sourcePkgDb initFlags initFlags' <- extendFlags installedPkgIndex sourcePkgDb initFlags
case license initFlags' of case license initFlags' of
Flag PublicDomain -> return () Flag SPDX.NONE -> return ()
_ -> writeLicense initFlags' _ -> writeLicense initFlags'
writeChangeLog initFlags' writeChangeLog initFlags'
createDirectories (sourceDirs initFlags') createDirectories (sourceDirs initFlags')
createLibHs initFlags' createLibHs initFlags'
...@@ -189,7 +186,7 @@ getSimpleProject flags = do ...@@ -189,7 +186,7 @@ getSimpleProject flags = do
flags { interactive = Flag False flags { interactive = Flag False
, simpleProject = Flag True , simpleProject = Flag True
, packageType = Flag LibraryAndExecutable , packageType = Flag LibraryAndExecutable
, cabalVersion = Flag (mkVersion [2,4]) , cabalVersion = Flag defaultCabalVersion
} }
simpleProjFlag@_ -> simpleProjFlag@_ ->
flags { simpleProject = simpleProjFlag } flags { simpleProject = simpleProjFlag }
...@@ -205,20 +202,21 @@ getCabalVersion flags = do ...@@ -205,20 +202,21 @@ getCabalVersion flags = do
cabVer <- return (flagToMaybe $ cabalVersion flags) cabVer <- return (flagToMaybe $ cabalVersion flags)
?>> maybePrompt flags (either (const defaultCabalVersion) id `fmap` ?>> maybePrompt flags (either (const defaultCabalVersion) id `fmap`
promptList "Please choose version of the Cabal specification to use" promptList "Please choose version of the Cabal specification to use"
[mkVersion [1,10], mkVersion [2,0], mkVersion [2,2], mkVersion [2,4]] [CabalSpecV1_10, CabalSpecV2_0, CabalSpecV2_2, CabalSpecV2_4, CabalSpecV3_0]
(Just defaultCabalVersion) displayCabalVersion False) (Just defaultCabalVersion) displayCabalVersion False)
?>> return (Just defaultCabalVersion) ?>> return (Just defaultCabalVersion)
return $ flags { cabalVersion = maybeToFlag cabVer } return $ flags { cabalVersion = maybeToFlag cabVer }
where where
displayCabalVersion :: Version -> String displayCabalVersion :: CabalSpecVersion -> String
displayCabalVersion v = case versionNumbers v of displayCabalVersion v = case v of
[1,10] -> "1.10 (legacy)" CabalSpecV1_10 -> "1.10 (legacy)"
[2,0] -> "2.0 (+ support for Backpack, internal sub-libs, '^>=' operator)" CabalSpecV2_0 -> "2.0 (+ support for Backpack, internal sub-libs, '^>=' operator)"
[2,2] -> "2.2 (+ support for 'common', 'elif', redundant commas, SPDX)" CabalSpecV2_2 -> "2.2 (+ support for 'common', 'elif', redundant commas, SPDX)"
[2,4] -> "2.4 (+ support for '**' globbing)" CabalSpecV2_4 -> "2.4 (+ support for '**' globbing)"
_ -> display v CabalSpecV3_0 -> "3.0 (+ set notation for ==, common stanzas in ifs, more redundant commas, better pkgconfig-depends)"
_ -> showCabalSpecVersion v
...@@ -269,39 +267,44 @@ getVersion flags = do ...@@ -269,39 +267,44 @@ getVersion flags = do
-- then prompt the user from a predefined list of licenses. -- then prompt the user from a predefined list of licenses.
getLicense :: InitFlags -> IO InitFlags getLicense :: InitFlags -> IO InitFlags
getLicense flags = do getLicense flags = do
lic <- return (flagToMaybe $ license flags) elic <- return (fmap Right $ flagToMaybe $ license flags)
?>> fmap (fmap (either UnknownLicense id)) ?>> maybePrompt flags (promptList "Please choose a license" listedLicenses Nothing prettyShow True)
(maybePrompt flags
(promptList "Please choose a license" listedLicenses case elic of
(Just BSD3) displayLicense True)) Nothing -> return flags { license = NoFlag }
Just (Right lic) -> return flags { license = Flag lic }
case checkLicenseInvalid lic of Just (Left str) -> case eitherParsec str of
Just msg -> putStrLn msg >> getLicense flags Right lic -> return flags { license = Flag lic }
Nothing -> return $ flags { license = maybeToFlag lic } -- on error, loop
Left err -> do
putStrLn "The license must be a valid SPDX expression."
putStrLn err
getLicense flags
where where
displayLicense l | needSpdx = prettyShow (licenseToSPDX l) -- perfectly we'll have this and writeLicense (in FileCreators)
| otherwise = display l -- in a single file
checkLicenseInvalid (Just (UnknownLicense t))
| needSpdx = case eitherParsec t :: Either String SPDX.License of
Right _ -> Nothing
Left _ -> Just "\nThe license must be a valid SPDX expression."
| otherwise = if any (not . isAlphaNum) t
then Just promptInvalidOtherLicenseMsg
else Nothing
checkLicenseInvalid _ = Nothing
promptInvalidOtherLicenseMsg = "\nThe license must be alphanumeric. " ++
"If your license name has many words, " ++
"the convention is to use camel case (e.g. PublicDomain). " ++
"Please choose a different license."
listedLicenses = listedLicenses =
knownLicenses \\ [GPL Nothing, LGPL Nothing, AGPL Nothing SPDX.NONE :
, Apache Nothing, OtherLicense] map (\lid -> SPDX.License (SPDX.ELicense (SPDX.ELicenseId lid) Nothing))
[ SPDX.BSD_2_Clause
needSpdx = maybe False (>= mkVersion [2,2]) $ flagToMaybe (cabalVersion flags) , SPDX.BSD_3_Clause
, SPDX.Apache_2_0
, SPDX.MIT
, SPDX.MPL_2_0
, SPDX.ISC
, SPDX.GPL_2_0_only
, SPDX.GPL_3_0_only
, SPDX.LGPL_2_1_only
, SPDX.LGPL_3_0_only
, SPDX.AGPL_3_0_only
, SPDX.GPL_2_0_or_later
, SPDX.GPL_3_0_or_later
, SPDX.LGPL_2_1_or_later
, SPDX.LGPL_3_0_or_later
, SPDX.AGPL_3_0_or_later
]
-- | The author's name and email. Prompt, or try to guess from an existing -- | The author's name and email. Prompt, or try to guess from an existing
-- darcs repo. -- darcs repo.
...@@ -641,7 +644,7 @@ chooseDep flags (m, Just ps) ...@@ -641,7 +644,7 @@ chooseDep flags (m, Just ps)
where where
pkgGroups = NE.groupBy ((==) `on` P.pkgName) (map P.packageId ps) pkgGroups = NE.groupBy ((==) `on` P.pkgName) (map P.packageId ps)
desugar = maybe True (< mkVersion [2]) $ flagToMaybe (cabalVersion flags) desugar = maybe True (< CabalSpecV2_0) $ flagToMaybe (cabalVersion flags)
-- Given a list of available versions of the same package, pick a dependency. -- Given a list of available versions of the same package, pick a dependency.
toDep :: NonEmpty P.PackageIdentifier -> IO P.Dependency toDep :: NonEmpty P.PackageIdentifier -> IO P.Dependency
......
...@@ -21,11 +21,11 @@ import Distribution.ModuleName ...@@ -21,11 +21,11 @@ import Distribution.ModuleName
( ModuleName ) -- And for the Text instance ( ModuleName ) -- And for the Text instance
import qualified Distribution.ModuleName as ModuleName import qualified Distribution.ModuleName as ModuleName
( fromString ) ( fromString )
import Distribution.Version import Distribution.CabalSpecVersion
( Version, mkVersion ) ( CabalSpecVersion (..))
defaultCabalVersion :: Version defaultCabalVersion :: CabalSpecVersion
defaultCabalVersion = mkVersion [1,10] defaultCabalVersion = CabalSpecV2_4
myLibModule :: ModuleName myLibModule :: ModuleName
myLibModule = ModuleName.fromString "MyLib" myLibModule = ModuleName.fromString "MyLib"
...@@ -49,10 +49,11 @@ import Distribution.Client.Init.Utils ...@@ -49,10 +49,11 @@ import Distribution.Client.Init.Utils
import Distribution.Client.Init.Types import Distribution.Client.Init.Types
( InitFlags(..), BuildType(..), PackageType(..) ) ( InitFlags(..), BuildType(..), PackageType(..) )
import Distribution.CabalSpecVersion
import Distribution.Deprecated.Text import Distribution.Deprecated.Text
( display, Text(..) ) ( display, Text(..) )
import Distribution.License import Distribution.License
( License(..), licenseToSPDX ) ( licenseFromSPDX )
import qualified Distribution.ModuleName as ModuleName import qualified Distribution.ModuleName as ModuleName
( toFilePath ) ( toFilePath )
import qualified Distribution.Package as P import qualified Distribution.Package as P
...@@ -63,8 +64,8 @@ import Distribution.Simple.Utils ...@@ -63,8 +64,8 @@ import Distribution.Simple.Utils
( dropWhileEndLE ) ( dropWhileEndLE )
import Distribution.Pretty import Distribution.Pretty
( prettyShow ) ( prettyShow )
import Distribution.Version
( mkVersion, orLaterVersion ) import qualified Distribution.SPDX as SPDX
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
...@@ -84,40 +85,31 @@ writeLicense flags = do ...@@ -84,40 +85,31 @@ writeLicense flags = do
message flags "\nGenerating LICENSE..." message flags "\nGenerating LICENSE..."
year <- show <$> getCurrentYear year <- show <$> getCurrentYear
let authors = fromMaybe "???" . flagToMaybe . author $ flags let authors = fromMaybe "???" . flagToMaybe . author $ flags
let isSimpleLicense :: SPDX.License -> Maybe SPDX.LicenseId
isSimpleLicense (SPDX.License (SPDX.ELicense (SPDX.ELicenseId lid) Nothing)) = Just lid
isSimpleLicense _ = Nothing
let licenseFile = let licenseFile =
case license flags of case flagToMaybe (license flags) >>= isSimpleLicense of
Flag BSD2 Just SPDX.BSD_2_Clause -> Just $ bsd2 authors year
-> Just $ bsd2 authors year Just SPDX.BSD_3_Clause -> Just $ bsd3 authors year
Just SPDX.Apache_2_0 -> Just apache20
Flag BSD3 Just SPDX.MIT -> Just $ mit authors year
-> Just $ bsd3 authors year Just SPDX.MPL_2_0 -> Just mpl20
Just SPDX.ISC -> Just $ isc authors year
Flag (GPL (Just v)) | v == mkVersion [2]
-> Just gplv2 -- GNU license come in "only" and "or-later" flavours
-- license file used are the same.
Flag (GPL (Just v)) | v == mkVersion [3] Just SPDX.GPL_2_0_only -> Just gplv2
-> Just gplv3 Just SPDX.GPL_3_0_only -> Just gplv3
Just SPDX.LGPL_2_1_only -> Just lgpl21
Flag (LGPL (Just v)) | v == mkVersion [2,1] Just SPDX.LGPL_3_0_only -> Just lgpl3
-> Just lgpl21 Just SPDX.AGPL_3_0_only -> Just agplv3
Flag (LGPL (Just v)) | v == mkVersion [3] Just SPDX.GPL_2_0_or_later -> Just gplv2
-> Just lgpl3 Just SPDX.GPL_3_0_or_later -> Just gplv3
Just SPDX.LGPL_2_1_or_later -> Just lgpl21
Flag (AGPL (Just v)) | v == mkVersion [3] Just SPDX.LGPL_3_0_or_later -> Just lgpl3
-> Just agplv3 Just SPDX.AGPL_3_0_or_later -> Just agplv3
Flag (Apache (Just v)) | v == mkVersion [2,0]
-> Just apache20
Flag MIT
-> Just $ mit authors year
Flag (MPL v) | v == mkVersion [2,0]
-> Just mpl20
Flag ISC
-> Just $ isc authors year
_ -> Nothing _ -> Nothing
...@@ -345,11 +337,11 @@ generateCabalFile fileName c = trimTrailingWS $ ...@@ -345,11 +337,11 @@ generateCabalFile fileName c = trimTrailingWS $
(++ "\n") . (++ "\n") .
renderStyle style { lineLength = 79, ribbonsPerLine = 1.1 } $ renderStyle style { lineLength = 79, ribbonsPerLine = 1.1 } $
-- Starting with 2.2 the `cabal-version` field needs to be the first line of the PD -- Starting with 2.2 the `cabal-version` field needs to be the first line of the PD
(if specVer < mkVersion [1,12] (if specVer < CabalSpecV1_12
then field "cabal-version" (Flag $ orLaterVersion specVer) -- legacy then fieldS "cabal-version" (Flag $ ">=" ++ showCabalSpecVersion specVer)
else field "cabal-version" (Flag $ specVer)) else fieldS "cabal-version" (Flag $ showCabalSpecVersion specVer))
Nothing -- NB: the first line must be the 'cabal-version' declaration Nothing
False False
$$ $$
(if minimal c /= Flag True (if minimal c /= Flag True
then showComment (Just $ "Initial package description '" ++ fileName ++ "' generated " then showComment (Just $ "Initial package description '" ++ fileName ++ "' generated "
...@@ -389,8 +381,9 @@ generateCabalFile fileName c = trimTrailingWS $ ...@@ -389,8 +381,9 @@ generateCabalFile fileName c = trimTrailingWS $
(Just "The license under which the package is released.") (Just "The license under which the package is released.")
True True
, case (license c) of , case license c of
Flag PublicDomain -> empty NoFlag -> empty
Flag SPDX.NONE -> empty
_ -> fieldS "license-file" (Flag "LICENSE") _ -> fieldS "license-file" (Flag "LICENSE")
(Just "The file containing the license text.") (Just "The file containing the license text.")
True True
...@@ -403,17 +396,15 @@ generateCabalFile fileName c = trimTrailingWS $ ...@@ -403,17 +396,15 @@ generateCabalFile fileName c = trimTrailingWS $
(Just "An email address to which users can send suggestions, bug reports, and patches.") (Just "An email address to which users can send suggestions, bug reports, and patches.")
True True
, case (license c) of , fieldS "copyright" NoFlag
Flag PublicDomain -> empty (Just "A copyright notice.")
_ -> fieldS "copyright" NoFlag True
(Just "A copyright notice.")
True
, fieldS "category" (either id display `fmap` category c) , fieldS "category" (either id display `fmap` category c)
Nothing Nothing
True True
, fieldS "build-type" (if specVer >= mkVersion [2,2] then NoFlag else Flag "Simple") , fieldS "build-type" (if specVer >= CabalSpecV2_2 then NoFlag else Flag "Simple")
Nothing Nothing
False False
...@@ -432,11 +423,8 @@ generateCabalFile fileName c = trimTrailingWS $ ...@@ -432,11 +423,8 @@ generateCabalFile fileName c = trimTrailingWS $
where where
specVer = fromMaybe defaultCabalVersion $ flagToMaybe (cabalVersion c) specVer = fromMaybe defaultCabalVersion $ flagToMaybe (cabalVersion c)
licenseStr | specVer < mkVersion [2,2] = prettyShow `fmap` license c licenseStr | specVer < CabalSpecV2_2 = prettyShow . licenseFromSPDX <$> license c
| otherwise = go `fmap` license c | otherwise = prettyShow <$> license c
where
go (UnknownLicense s) = s
go l = prettyShow (licenseToSPDX l)
generateBuildInfo :: BuildType -> InitFlags -> Doc generateBuildInfo :: BuildType -> InitFlags -> Doc
generateBuildInfo buildType c' = vcat generateBuildInfo buildType c' = vcat
......
...@@ -15,16 +15,16 @@ ...@@ -15,16 +15,16 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
module Distribution.Client.Init.Types where module Distribution.Client.Init.Types where
import Distribution.Simple.Setup import Distribution.Simple.Setup (Flag(..), toFlag )
( Flag(..) )
import Distribution.Types.Dependency as P import Distribution.Types.Dependency as P
import Distribution.Compat.Semigroup import Distribution.Compat.Semigroup
import Distribution.Version import Distribution.Version
import Distribution.Verbosity import Distribution.Verbosity
import qualified Distribution.Package as P import qualified Distribution.Package as P
import Distribution.License import Distribution.SPDX.License (License)
import Distribution.ModuleName import Distribution.ModuleName
import Distribution.CabalSpecVersion
import Language.Haskell.Extension ( Language(..), Extension ) import Language.Haskell.Extension ( Language(..), Extension )
import qualified Text.PrettyPrint as Disp import qualified Text.PrettyPrint as Disp
...@@ -48,7 +48,7 @@ data InitFlags = ...@@ -48,7 +48,7 @@ data InitFlags =
, packageName :: Flag P.PackageName , packageName :: Flag P.PackageName
, version :: Flag Version , version :: Flag Version
, cabalVersion :: Flag Version , cabalVersion :: Flag CabalSpecVersion
, license :: Flag License , license :: Flag License
, author :: Flag String , author :: Flag String
, email :: Flag String , email :: Flag String
...@@ -103,6 +103,11 @@ instance Monoid InitFlags where ...@@ -103,6 +103,11 @@ instance Monoid InitFlags where
instance Semigroup InitFlags where instance Semigroup InitFlags where
(<>) = gmappend (<>) = gmappend
defaultInitFlags :: InitFlags
defaultInitFlags = mempty
{ initVerbosity = toFlag normal
}
-- | Some common package categories (non-exhaustive list). -- | Some common package categories (non-exhaustive list).
data Category data Category
= Codec = Codec
......
...@@ -79,7 +79,7 @@ import Distribution.Client.Dependency.Types ...@@ -79,7 +79,7 @@ import Distribution.Client.Dependency.Types
import Distribution.Client.IndexUtils.IndexState import Distribution.Client.IndexUtils.IndexState
( TotalIndexState, headTotalIndexState ) ( TotalIndexState, headTotalIndexState )
import qualified Distribution.Client.Init.Types as IT import qualified Distribution.Client.Init.Types as IT
( InitFlags(..), PackageType(..) ) ( InitFlags(..), PackageType(..), defaultInitFlags )
import Distribution.Client.Targets import Distribution.Client.Targets
( UserConstraint, readUserConstraint ) ( UserConstraint, readUserConstraint )
import Distribution.Utils.NubList import Distribution.Utils.NubList
...@@ -142,6 +142,7 @@ import Distribution.Client.GlobalFlags ...@@ -142,6 +142,7 @@ import Distribution.Client.GlobalFlags
, RepoContext(..), withRepoContext , RepoContext(..), withRepoContext
) )
import Distribution.Client.ManpageFlags (ManpageFlags, defaultManpageFlags, manpageOptions) import Distribution.Client.ManpageFlags (ManpageFlags, defaultManpageFlags, manpageOptions)
import Distribution.Parsec.Newtypes (SpecVersion (..))
import Data.List import Data.List
( deleteFirstsBy ) ( deleteFirstsBy )
...@@ -2251,12 +2252,6 @@ instance Semigroup UploadFlags where ...@@ -2251,12 +2252,6 @@ instance Semigroup UploadFlags where
-- * Init flags -- * Init flags
-- ------------------------------------------------------------ -- ------------------------------------------------------------
emptyInitFlags :: IT.InitFlags
emptyInitFlags = mempty
defaultInitFlags :: IT.InitFlags
defaultInitFlags = emptyInitFlags { IT.initVerbosity = toFlag normal }
initCommand :: CommandUI IT.InitFlags initCommand :: CommandUI IT.InitFlags
initCommand = CommandUI { initCommand = CommandUI {
commandName = "init", commandName = "init",
...@@ -2274,7 +2269,7 @@ initCommand = CommandUI { ...@@ -2274,7 +2269,7 @@ initCommand = CommandUI {
commandNotes = Nothing, commandNotes = Nothing,
commandUsage = \pname -> commandUsage = \pname ->
"Usage: " ++ pname ++ " init [FLAGS]\n", "Usage: " ++ pname ++ " init [FLAGS]\n",
commandDefaultFlags = defaultInitFlags, commandDefaultFlags = IT.defaultInitFlags,
commandOptions = initOptions