Skip to content

Commit

Permalink
Merge pull request avh4#207 from gyzerok/patch-2
Browse files Browse the repository at this point in the history
fix avh4#186: make console output less verbose
  • Loading branch information
avh4 authored Jun 24, 2016
2 parents 92716c6 + f2116e9 commit fba3025
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/ElmFormat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ processTextInput elmVersion destination inputFile inputText =
processFileInput :: ElmVersion -> FilePath -> Destination -> IO (Maybe Bool)
processFileInput elmVersion inputFile destination =
do
putStrLn $ (r $ ProcessingFile inputFile)
inputText <- fmap Text.decodeUtf8 $ ByteString.readFile inputFile
processTextInput elmVersion destination inputFile inputText

Expand Down Expand Up @@ -162,6 +161,7 @@ handleFilesInput inputFiles outputFile autoYes validateOnly elmVersion =
Right [inputFile] -> do
realOutputFile <- decideOutputFile autoYes inputFile outputFile
let destination = if validateOnly then ValidateOnly else ToFile realOutputFile
putStrLn $ (r $ ProcessingFiles $ [inputFile])
processFileInput elmVersion inputFile destination

Right elmFiles -> do
Expand All @@ -187,6 +187,7 @@ handleFilesInput inputFiles outputFile autoYes validateOnly elmVersion =
ToFile file
in
do
putStrLn $ (r $ ProcessingFiles elmFiles)
validationResults <- mapM (\file -> processFileInput elmVersion file (dst file)) elmFiles
return $ foldl merge Nothing validationResults
else
Expand Down
8 changes: 6 additions & 2 deletions src/Messages/Strings.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ renderMessage Error_SingleOutputWithMultipleInputs =
, "Please remove the --output argument. The .elm files in INPUT will be formatted in place."
]

renderMessage (ProcessingFile file) =
"Processing file " ++ file
renderMessage (ProcessingFiles files) =
case files of
file:[] ->
"Processing file " ++ file
_ ->
"Processing multiple files..."

renderMessage (FileWouldChange file) =
"File would be changed " ++ file
Expand Down
2 changes: 1 addition & 1 deletion src/Messages/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data Message
| Error_SingleOutputWithMultipleInputs
| Error_TooManyInputs
| Error_OutputAndValidate
| ProcessingFile FilePath
| ProcessingFiles [FilePath]
| FileWouldChange FilePath


Expand Down

0 comments on commit fba3025

Please sign in to comment.