This repository was archived by the owner on Apr 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow to format list-* task output as list
- Loading branch information
1 parent
b1c6cc2
commit afe35fa
Showing
3 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const User = require('../models/User'); | ||
const inspect = require('../helpers/inspect'); | ||
|
||
/** | ||
* config = { | ||
* logger: { info: Function, error: Function }, | ||
* } | ||
*/ | ||
exports.configure = config => async (asList) => { | ||
const users = await User.find().catch([]); | ||
const emails = [...new Set(users.map((r) => r.email).filter((email) => /@/.test(email)))]; | ||
|
||
if (asList) { | ||
console.log(emails.join('\n')) | ||
} else { | ||
config.logger.info(inspect(emails)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters