-
Notifications
You must be signed in to change notification settings - Fork 711
Add "status" command #2882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "status" command #2882
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ module Distribution.Text ( | |
defaultStyle, | ||
display, | ||
simpleParse, | ||
render, | ||
brokenString | ||
) where | ||
|
||
import qualified Distribution.Compat.ReadP as Parse | ||
|
@@ -28,16 +30,28 @@ class Text a where | |
disp :: a -> Disp.Doc | ||
parse :: Parse.ReadP r a | ||
|
||
-- | The default rendering style used in Cabal for console output. | ||
defaultStyle :: Disp.Style | ||
defaultStyle = Disp.Style { Disp.mode = Disp.PageMode | ||
, Disp.lineLength = 79 | ||
, Disp.ribbonsPerLine = 1.0 | ||
} | ||
|
||
-- | Display a 'Text' value with the Cabal default style. | ||
display :: Text a => a -> String | ||
display = Disp.renderStyle defaultStyle . disp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this change needed? |
||
|
||
-- | similar to Disp.render, but using the Cabal default style | ||
-- (which is different from Text.Prettyprint default). | ||
render :: Disp.Doc -> String | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to have a Haddock comment here also. |
||
render = Disp.renderStyle defaultStyle | ||
|
||
-- | Takes a string, and turns it into a paragraph-like | ||
-- Doc, i.e. an fsep of the words in it. Main purpose is | ||
-- to produce indented paragraphs. | ||
brokenString :: String -> Disp.Doc | ||
brokenString s = Disp.fsep $ fmap Disp.text $ words s | ||
|
||
defaultStyle :: Disp.Style | ||
defaultStyle = Disp.Style | ||
{ Disp.mode = Disp.PageMode | ||
, Disp.lineLength = 79 -- Disp default: 100 | ||
, Disp.ribbonsPerLine = 1.0 -- Disp default: 1.5 | ||
} | ||
|
||
simpleParse :: Text a => String -> Maybe a | ||
simpleParse str = case [ p | (p, s) <- Parse.readP_to_S parse str | ||
, all Char.isSpace s ] of | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
1.25.x.x (current development version) | ||
* Dropped support for versions of GHC earlier than 6.12 (#3111). | ||
* Add command 'status' | ||
|
||
1.24.0.0 Ryan Thomas <[email protected]> March 2016 | ||
* Support GHC 8. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -349,6 +349,33 @@ $ cabal --ignore-sandbox install text | |
# Installs 'text' in the user package database ('~/.cabal'). | ||
~~~~~~~~~~~~~~~ | ||
|
||
## Displaying cabal environment information ## | ||
|
||
A cabal environment (the directory containing a package) has a certain state. | ||
One example are the flags of the last (successful) configuration. The | ||
`cabal status` command will print a summary over several | ||
aspects of the environment, such as | ||
|
||
* the cabal version; | ||
|
||
* the (configured) versions of the compiler and other build-time dependencies; | ||
|
||
* the package, its components and the install-plan; | ||
|
||
* the (contents of) package-databases, the sandbox etc. | ||
|
||
Just `cabal status` will display a default selection of information. | ||
Flags can be used to print specific items only; `cabal status --all` will | ||
print the full summary. | ||
|
||
Example: | ||
|
||
~~~~~~~~~~~~~~~ | ||
$ cabal status --compiler | ||
Configured compiler: | ||
ghc-7.10.3 | ||
~~~~~~~~~~~~~~~ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See here for the only addition apart from rebasing since last update. |
||
## Creating a binary package ## | ||
|
||
When creating binary packages (e.g. for Red Hat or Debian) one needs to | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a Haddock comment explaining what this function does.