Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
Packages
Cabal
Commits
d0039e24
Commit
d0039e24
authored
6 years ago
by
Alexis Williams
Browse files
Options
Downloads
Patches
Plain Diff
Musical chairs to switch defaults to 'v2' commands.
parent
e5618f91
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cabal-install/Distribution/Client/CmdLegacy.hs
+9
-15
9 additions, 15 deletions
cabal-install/Distribution/Client/CmdLegacy.hs
with
9 additions
and
15 deletions
cabal-install/Distribution/Client/CmdLegacy.hs
+
9
−
15
View file @
d0039e24
...
...
@@ -130,10 +130,8 @@ legacyNote cmd = wrapText $
"For more information, see: https://wiki.haskell.org/Cabal/NewBuild
\n
"
toLegacyCmd
::
(
Bool
->
CommandSpec
(
globals
->
IO
action
))
->
[
CommandSpec
(
globals
->
IO
action
)]
toLegacyCmd
mkSpec
=
[
toDeprecated
(
mkSpec
True
),
toLegacy
(
mkSpec
False
)]
toLegacyCmd
mkSpec
=
[
toLegacy
(
mkSpec
False
)]
where
legacyMsg
=
T
.
unpack
.
T
.
replace
"v1-"
""
.
T
.
pack
toLegacy
(
CommandSpec
origUi
@
CommandUI
{
..
}
action
type'
)
=
CommandSpec
legUi
action
type'
where
legUi
=
origUi
...
...
@@ -143,17 +141,6 @@ toLegacyCmd mkSpec = [toDeprecated (mkSpec True), toLegacy (mkSpec False)]
Nothing
->
legacyNote
commandName
}
toDeprecated
(
CommandSpec
origUi
@
CommandUI
{
..
}
action
type'
)
=
CommandSpec
depUi
action
type'
where
depUi
=
origUi
{
commandName
=
legacyMsg
commandName
,
commandUsage
=
legacyMsg
.
commandUsage
,
commandDescription
=
(
legacyMsg
.
)
<$>
commandDescription
,
commandNotes
=
Just
$
\
pname
->
case
commandNotes
of
Just
notes
->
legacyMsg
(
notes
pname
)
++
"
\n
"
++
deprecationNote
commandName
Nothing
->
deprecationNote
commandName
}
legacyCmd
::
(
HasVerbosity
flags
)
=>
CommandUI
flags
->
(
flags
->
[
String
]
->
globals
->
IO
action
)
->
[
CommandSpec
(
globals
->
IO
action
)]
legacyCmd
ui
action
=
toLegacyCmd
(
regularCmd
ui
action
)
...
...
@@ -161,7 +148,7 @@ legacyWrapperCmd :: Monoid flags => CommandUI flags -> (flags -> Setup.Flag Verb
legacyWrapperCmd
ui
verbosity'
distPref
=
toLegacyCmd
(
wrapperCmd
ui
verbosity'
distPref
)
newCmd
::
CommandUI
flags
->
(
flags
->
[
String
]
->
globals
->
IO
action
)
->
[
CommandSpec
(
globals
->
IO
action
)]
newCmd
origUi
@
CommandUI
{
..
}
action
=
[
cmd
v2Ui
,
cmd
origUi
]
newCmd
origUi
@
CommandUI
{
..
}
action
=
[
cmd
defaultUi
,
cmd
v2Ui
,
cmd
origUi
]
where
cmd
ui
=
CommandSpec
ui
(
flip
commandAddAction
action
)
NormalCommand
v2Msg
=
T
.
unpack
.
T
.
replace
"new-"
"v2-"
.
T
.
pack
...
...
@@ -171,3 +158,10 @@ newCmd origUi@CommandUI{..} action = [cmd v2Ui, cmd origUi]
,
commandDescription
=
(
v2Msg
.
)
<$>
commandDescription
,
commandNotes
=
(
v2Msg
.
)
<$>
commandDescription
}
defaultMsg
=
T
.
unpack
.
T
.
replace
"new-"
""
.
T
.
pack
defaultUi
=
origUi
{
commandName
=
defaultMsg
commandName
,
commandUsage
=
defaultMsg
.
commandUsage
,
commandDescription
=
(
defaultMsg
.
)
<$>
commandDescription
,
commandNotes
=
(
defaultMsg
.
)
<$>
commandDescription
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment