-
Notifications
You must be signed in to change notification settings - Fork 691
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
And make it pipe output to `man -l -`.
- Loading branch information
Showing
10 changed files
with
105 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{-# LANGUAGE DeriveGeneric #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
module Distribution.Client.ManpageFlags | ||
( ManpageFlags (..) | ||
, defaultManpageFlags | ||
, manpageOptions, | ||
) where | ||
|
||
import Distribution.Client.Compat.Prelude | ||
|
||
import Distribution.Simple.Command (OptionField (..), ShowOrParseArgs (..), option) | ||
import Distribution.Simple.Setup (Flag (..), toFlag, trueArg, optionVerbosity) | ||
import Distribution.Verbosity (Verbosity, normal) | ||
|
||
data ManpageFlags = ManpageFlags | ||
{ manpageVerbosity :: Flag Verbosity | ||
, manpageRaw :: Flag Bool | ||
} deriving (Eq, Show, Generic) | ||
|
||
instance Monoid ManpageFlags where | ||
mempty = gmempty | ||
mappend = (<>) | ||
|
||
instance Semigroup ManpageFlags where | ||
(<>) = gmappend | ||
|
||
defaultManpageFlags :: ManpageFlags | ||
defaultManpageFlags = ManpageFlags | ||
{ manpageVerbosity = toFlag normal | ||
, manpageRaw = toFlag False | ||
} | ||
|
||
manpageOptions :: ShowOrParseArgs -> [OptionField ManpageFlags] | ||
manpageOptions _ = | ||
[ optionVerbosity manpageVerbosity (\v flags -> flags { manpageVerbosity = v }) | ||
, option "" ["raw"] | ||
"Output raw troff content" | ||
manpageRaw (\v flags -> flags { manpageRaw = v }) | ||
trueArg | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# cabal manpage | ||
# cabal man --raw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import Test.Cabal.Prelude | ||
main = cabalTest $ do | ||
r <- cabal' "manpage" [] | ||
r <- cabal' "man" ["--raw"] | ||
assertOutputContains ".B cabal install" r | ||
assertOutputDoesNotContain ".B cabal manpage" r |