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
eb5c6079
Commit
eb5c6079
authored
3 years ago
by
Mel Zuser
Browse files
Options
Downloads
Patches
Plain Diff
Reduce default verbosity for running scripts
Closes #5508
parent
19468bfc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cabal-install/src/Distribution/Client/CmdRun.hs
+8
-6
8 additions, 6 deletions
cabal-install/src/Distribution/Client/CmdRun.hs
changelog.d/pr-7851
+3
-2
3 additions, 2 deletions
changelog.d/pr-7851
doc/cabal-commands.rst
+15
-0
15 additions, 0 deletions
doc/cabal-commands.rst
with
26 additions
and
8 deletions
cabal-install/src/Distribution/Client/CmdRun.hs
+
8
−
6
View file @
eb5c6079
...
...
@@ -2,6 +2,7 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
-- | cabal-install CLI command: run
--
...
...
@@ -43,7 +44,7 @@ import Distribution.Simple.Command
import
Distribution.Types.ComponentName
(
showComponentName
)
import
Distribution.Verbosity
(
normal
)
(
normal
,
silent
)
import
Distribution.Simple.Utils
(
wrapText
,
die'
,
info
,
notice
)
import
Distribution.Client.ProjectPlanning
...
...
@@ -120,10 +121,12 @@ runCommand = CommandUI
runAction
::
NixStyleFlags
()
->
[
String
]
->
GlobalFlags
->
IO
()
runAction
flags
@
NixStyleFlags
{
..
}
targetAndArgs
globalFlags
=
withContextAndSelectors
RejectNoTargets
(
Just
ExeKind
)
flags
targetStr
globalFlags
$
\
targetCtx
ctx
targetSelectors
->
do
baseCtx
<-
case
targetCtx
of
ProjectContext
->
return
ctx
GlobalContext
->
return
ctx
ScriptContext
path
exemeta
->
updateContextAndWriteProjectFile
ctx
path
exemeta
(
baseCtx
,
defaultVerbosity
)
<-
case
targetCtx
of
ProjectContext
->
return
(
ctx
,
normal
)
GlobalContext
->
return
(
ctx
,
normal
)
ScriptContext
path
exemeta
->
(,
silent
)
<$>
updateContextAndWriteProjectFile
ctx
path
exemeta
let
verbosity
=
fromFlagOrDefault
defaultVerbosity
(
configVerbosity
configFlags
)
buildCtx
<-
runProjectPreBuildPhase
verbosity
baseCtx
$
\
elaboratedPlan
->
do
...
...
@@ -232,7 +235,6 @@ runAction flags@NixStyleFlags {..} targetAndArgs globalFlags
elaboratedPlan
}
where
verbosity
=
fromFlagOrDefault
normal
(
configVerbosity
configFlags
)
(
targetStr
,
args
)
=
splitAt
1
targetAndArgs
-- | Used by the main CLI parser as heuristic to decide whether @cabal@ was
...
...
This diff is collapsed.
Click to expand it.
changelog.d/pr-7851
+
3
−
2
View file @
eb5c6079
synopsis: Better support for scripts
packages: cabal-install
prs: #7851 #7925 #7938
issues: #7842 #7073 #6354 #6149
prs: #7851 #7925 #7938
#7990
issues: #7842 #7073 #6354 #6149
#5508
description: {
...
...
@@ -14,5 +14,6 @@ description: {
- `cabal list-bin` now works with scripts
- The name of the generated script executable has been changed from "script" to
"cabal-script-<your-sanitized-script-name>" for easier process management.
- Reduce the default verbosity of scripts, so that the build output doesn't interfere with the script output.
}
This diff is collapsed.
Click to expand it.
doc/cabal-commands.rst
+
15
−
0
View file @
eb5c6079
...
...
@@ -489,6 +489,21 @@ A note on targets: Whenever a command takes a script target and it matches the
name of another target, the other target is preferred. To load the script
instead pass it as an explicit path: ./script
By default, scripts are run at silent verbosity (``--verbose=0``). To show the
build output for a script either use the command
::
$ cabal v2-run --verbose=n path/to/script
or the interpreter line
::
#!/usr/bin/env -S cabal v2-run --verbose=n
For more information see :cfg-field:`verbose`
cabal v2-freeze
----------------
...
...
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