Last active
July 13, 2020 17:57
-
-
Save wswoodruff/cfbf552c9ed769b6987f562889b22ec6 to your computer and use it in GitHub Desktop.
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
// lib/expose/commands.js | |
// See a list of hpal commands via 'hpal run --list' | |
'use strict'; | |
const internals = {}; | |
module.exports = (server, options) => ({ | |
// Run this command via 'hpal run my-project:recent-jobs' | |
recentJobs: { | |
// 'sinceDays' is a CLI arg passed to hpal. | |
// ex: `hpal run my-project:recent-jobs 100` | |
// Reminder: See all available commands with `hpal run --list` | |
command: async (srv, [sinceDays]) => { | |
const { Job } = srv.models(); | |
const { jobService } = srv.services(); | |
const searchResults = await jobService.search({ | |
sinceDays: sinceDays || 30 | |
}); | |
console.log(searchResults.length); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment