Skip to content

Commit 67b7d70

Browse files
committed
Tidy up listDepsFormatOptsParser, for help output
1 parent 61117aa commit 67b7d70

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

.hlint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
# the GHC2021 set. Other extensions can be added, if need be.
5858
- name:
5959
- NoImplicitPrelude
60+
- ApplicativeDo
6061
- ConstraintKinds
6162
- DataKinds
6263
- DefaultSignatures

src/Stack/Options/LsParser.hs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
2+
{-# LANGUAGE ApplicativeDo #-}
23
{-# LANGUAGE OverloadedStrings #-}
34

45
-- | Function to parse command line arguments for Stack's @ls@ command.
@@ -19,7 +20,7 @@ import Stack.Ls
1920
, LsView (..), SnapshotOpts (..), ListGlobalsOpts
2021
)
2122
import Stack.Options.DotParser ( dotOptsParser )
22-
import Stack.Prelude
23+
import Stack.Prelude hiding ( sep )
2324

2425
-- | Parse command line arguments for Stack's @ls@ command.
2526
lsOptsParser :: OA.Parser LsCmdOpts
@@ -48,9 +49,9 @@ lsDepsCmd :: OA.Mod OA.CommandFields LsCmds
4849
lsDepsCmd = OA.command "dependencies" $
4950
OA.info lsDepOptsParser $
5051
OA.progDesc
51-
"View the packages and versions used for a project. Use a command if \
52-
\the first target specified has the name of a command. Targets other \
53-
\than project packages are ignored."
52+
"View the packages versions used for a project. Use a command if the \
53+
\first target specified has the name of a command. Targets other than \
54+
\project packages are ignored."
5455
<> OA.footer globalFooter
5556

5657
lsStylesCmd :: OA.Mod OA.CommandFields LsCmds
@@ -193,17 +194,21 @@ listDepsJsonParser :: OA.Parser ListDepsFormat
193194
listDepsJsonParser = pure ListDepsJSON
194195

195196
listDepsFormatOptsParser :: OA.Parser ListDepsFormatOpts
196-
listDepsFormatOptsParser = ListDepsFormatOpts
197-
<$> separatorParser
198-
<*> licenseParser
197+
listDepsFormatOptsParser = do
198+
license <- licenseParser
199+
sep <- separatorParser
200+
pure ListDepsFormatOpts
201+
{ sep
202+
, license
203+
}
199204

200205
separatorParser :: OA.Parser Text
201206
separatorParser = fmap
202207
escapeSep
203208
( textOption
204209
( OA.long "separator"
205210
<> OA.metavar "SEP"
206-
<> OA.help "Separator between package name and package version."
211+
<> OA.help "Separator between package name and what follows."
207212
<> OA.value " "
208213
<> OA.showDefault
209214
)

0 commit comments

Comments
 (0)