Skip to content

Commit

Permalink
Rename executable to stackage-view
Browse files Browse the repository at this point in the history
Also add support for --summary argument
  • Loading branch information
snoyberg committed Apr 20, 2015
1 parent e8b9b08 commit 94877b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion app/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Data.Monoid
import Network.Wai.Handler.Warp
import Prelude
import System.Environment
import System.Exit (exitSuccess)
import Text.Read

import Options.Applicative
Expand All @@ -18,8 +19,16 @@ runWithOptions opts =
do putStrLn ("Point your browser to http://localhost:" ++ show (appPort opts) ++ "/")
runApplication (appPort opts)

handleSummary :: IO ()
handleSummary = do
args <- getArgs
when (args == ["--summary"]) $ do
putStrLn "Interactive GUI explorer for your Haskell source code"
exitSuccess

main :: IO ()
main = do mport <- fmap (bind readMaybe . lookup "PORT") getEnvironment
main = do handleSummary
mport <- fmap (bind readMaybe . lookup "PORT") getEnvironment
bind runWithOptions
(execParser (info (parser mport) mempty))
where parser mport =
Expand Down
2 changes: 1 addition & 1 deletion stackage-view.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ library
if !os(windows)
build-depends: unix

executable fpview
executable stackage-view
if flag(library-only)
Buildable: False

Expand Down

0 comments on commit 94877b9

Please sign in to comment.