Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wswoodruff/cfbf552c9ed769b6987f562889b22ec6 to your computer and use it in GitHub Desktop.
Save wswoodruff/cfbf552c9ed769b6987f562889b22ec6 to your computer and use it in GitHub Desktop.
// 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