Make --json and --quiet suppress automatic init messages

And any other messages that might be output before a command starts.

Fixes a reversion introduced in version 5.20150727.

During the optparse-applicative conversion, I needed a place to run
per-command global option setters, and I made it get run during the seek stage. But
that is too late to have --json and --quiet disable output produced in the
check stage. Fix is just to run those per-command global option setters at
the same time as the all-command global option setters.

This commit was sponsored by Thom May.
This commit is contained in:
Joey Hess 2016-09-05 15:32:59 -04:00
parent c9082cf0e4
commit 219e2fa157
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
6 changed files with 21 additions and 14 deletions

View file

@ -99,7 +99,7 @@ parseCmd progname progdesc globaloptions allargs allcmds getparser =
mkparser c = (,,)
<$> pure c
<*> getparser c
<*> combineGlobalOptions globaloptions
<*> combineGlobalOptions (globaloptions ++ cmdglobaloptions c)
synopsis n d = n ++ " - " ++ d
intro = mconcat $ concatMap (\l -> [H.text l, H.line])
(synopsis progname progdesc : commandList allcmds)