Skip to content

Commit

Permalink
Ensure we still log when using --dry-run
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Jul 31, 2024
1 parent 51c7e19 commit 5fb671e
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/Restyler/Restyler/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,22 @@ dockerRunRestyler r@Restyler {..} WithProgress {..} = do
[path] -> pack path
paths -> show (length paths) <> " paths"

ec <-
if dryRun
then pure ExitSuccess
else case pItem of
DockerRunPathToStdout path -> do
logRunningOn [path]
(ec, out) <- dockerRunStdout $ args <> [prefix path]
ec <$ writeFile path (fixNewline out)
DockerRunPathsOverwrite sep paths -> do
logRunningOn paths
dockerRun $ args <> ["--" | sep] <> map prefix paths
DockerRunPathOverwrite sep path -> do
logRunningOn [path]
dockerRun $ args <> ["--" | sep] <> [prefix path]
unlessDryRun f
| dryRun = pure ExitSuccess
| otherwise = f

ec <- case pItem of
DockerRunPathToStdout path -> do
logRunningOn [path]
unlessDryRun $ do
(ec, out) <- dockerRunStdout $ args <> [prefix path]
ec <$ writeFile path (fixNewline out)
DockerRunPathsOverwrite sep paths -> do
logRunningOn paths
unlessDryRun $ dockerRun $ args <> ["--" | sep] <> map prefix paths
DockerRunPathOverwrite sep path -> do
logRunningOn [path]
unlessDryRun $ dockerRun $ args <> ["--" | sep] <> [prefix path]

case ec of
ExitSuccess -> pure ()
Expand Down

0 comments on commit 5fb671e

Please sign in to comment.