
const { subcommand, pluralizeCount, println } = require('../../util');

module.exports = {
  command: 'gc',
  description: 'Trigger garbage collection to remove orphan data objects that are not referenced by any statement.\n',
  handler: subcommand(opts => {
    const { client } = opts;
    return client.garbageCollectDatastore().then(count => {
      println(`Garbage collected ${ pluralizeCount(count, 'object') }`);
    });
  })
};