Skip to content

Commit

Permalink
fix: improve logging for common situations
Browse files Browse the repository at this point in the history
  • Loading branch information
varl committed Nov 22, 2019
1 parent ab63b9b commit 0b435db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/commands/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ const handler = (argv, apply) => {
opts.files = selectFiles(files, pattern, staged)

if (opts.files.length === 0) {
log.debug('No files to work on...')
log.warn(
`No matching ${
staged ? 'staged ' : ''
}files for pattern "${pattern}"`
)
return
}

Expand All @@ -54,6 +58,8 @@ const handler = (argv, apply) => {
config: prettierConfig,
...opts,
})

log.info(`${opts.files.length} file(s) ${apply ? 'fixed' : 'checked'}`)
}

const javascriptCmds = yargs => {
Expand Down
8 changes: 7 additions & 1 deletion src/commands/structured-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ const handler = (argv, apply) => {
opts.files = selectFiles(files, pattern, staged)

if (opts.files.length === 0) {
log.debug('No files to work on...')
log.warn(
`No matching ${
staged ? 'staged ' : ''
}files for pattern "${pattern}"`
)
return
}

Expand All @@ -44,6 +48,8 @@ const handler = (argv, apply) => {
config: prettierConfig,
...opts,
})

log.info(`${opts.files.length} file(s) ${apply ? 'fixed' : 'checked'}`)
}

const textCmds = yargs => {
Expand Down

0 comments on commit 0b435db

Please sign in to comment.