-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
executable file
·25 lines (22 loc) · 1001 Bytes
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env node
// Copyright (c) WarnerMedia Direct, LLC. All rights reserved. Licensed under the MIT license.
// See the LICENSE file for license information.
const sywac = require('sywac');
const { cleanupUnusedAgents } = require('.');
sywac
.string('--org', { desc: 'organization name', required: true })
.string('--token', { desc: 'API token in Azure DevOps', required: true })
.array('--pool', { desc: 'pool name(s) to clean up', required: true })
.number('--delay', { desc: 'number of seconds to pause', required: false, defaultValue: 180 })
.help('-h,--help', { desc: 'show help' })
.example('$0 --org MyAzureOrg --pool "My Pool" --token myapitoken --delay 240', {
desc: 'Delete unused agents with a safety delay of 240 seconds'
})
.strict()
.style(require('sywac-style-chunky'))
.parseAndExit()
.then(argv => cleanupUnusedAgents(argv))
.catch(error => {
console.error(error.message);
process.exitCode = 1;
});