-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
31 lines (23 loc) · 836 Bytes
/
index.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
26
27
28
29
30
31
#!/usr/bin/env node
const chalk = require('chalk'),
orchestrator = require('./lib/orchestrator');
module.exports = function (callback) {
// 1. Read collection file
// 2. Get all environment variables from the collection JSON
// 3. Compose Environment Body JSON
// 4. Send request to Postman API
// 5. Exit, giving status to the user
let filePath = process.argv[2],
environmentName = process.argv[3],
apiKey = process.argv[4],
workspaceId = process.argv[5];
orchestrator(filePath, environmentName, apiKey, workspaceId, function (err, results) {
if (err) {
console.error('Error: ', err);
return callback(err);
}
console.log(chalk.magenta('Created environment details', JSON.stringify(results)));
return callback();
})
}
!module.parent && module.exports(process.exit);