Skip to content

Commit

Permalink
Fix #139: don't create a connfiguration automatically if not found
Browse files Browse the repository at this point in the history
  • Loading branch information
f-f committed Mar 15, 2019
1 parent 0b4a881 commit 95865cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Spago/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ parseConfig dhallText = do
ensureConfig :: IO Config
ensureConfig = do
exists <- T.testfile path
T.unless exists $ makeConfig False
T.unless exists $ do
die $ Messages.cannotFindConfig
PackageSet.ensureFrozen
configText <- T.readTextFile path
try (parseConfig configText) >>= \case
Expand Down
8 changes: 8 additions & 0 deletions app/Spago/Messages.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import Data.Text (Text)
import qualified Data.Text as Text


cannotFindConfig :: Text
cannotFindConfig = makeMessage
[ "There's no " <> surroundQuote "spago.dhall" <> "in your current location."
, ""
, "If you already have a spago project you might be in the wrong subdirectory,"
, "otherwise you might want to run `spago init` to initialize a new project."
]

foundExistingProject :: Text -> Text
foundExistingProject pathText = makeMessage
[ "Found " <> pathText <> ": it looks like there's already a project here."
Expand Down

0 comments on commit 95865cc

Please sign in to comment.