Comparing version 0.0.4 to 0.1.0
@@ -13,2 +13,3 @@ 'use strict'; | ||
const podname = opts.p || opts.pod; | ||
const subname = opts.s || opts.sub || opts.subname || ''; | ||
const args = ['logs'].concat(opts.args); | ||
@@ -18,4 +19,4 @@ | ||
_.forEach(list, item => { | ||
console.log(`[${item.name}]`); | ||
const logger = spawn('kubectl', args.concat(item.name)) | ||
console.log(`[${item.name}] ${subname ? subname : ''}`); | ||
const logger = spawn('kubectl', args.concat(item.name, subname)) | ||
.on('error', err => console.error(err)) | ||
@@ -22,0 +23,0 @@ .on('close', err => console.log('close', err)); |
'use strict'; | ||
const _ = require('lodash'); | ||
const Aigle = require('aigle'); | ||
const inquirer = require('inquirer'); | ||
const Promise = require('bluebird'); | ||
const exec = Promise.promisify(require('child_process').exec); | ||
const exec = Aigle.promisify(require('child_process').exec); | ||
const prompt = inquirer.createPromptModule(); | ||
@@ -41,3 +41,3 @@ | ||
if (_.isEmpty(pods)) { | ||
return Promise.reject(new Error('Pod not found')); | ||
return Aigle.reject(new Error('Pod not found')); | ||
} | ||
@@ -54,3 +54,3 @@ console.log('pod list:'); | ||
if (!confirm) { | ||
return Promise.reject(new Error('Confirmation failed')); | ||
return Aigle.reject(new Error('Confirmation failed')); | ||
} | ||
@@ -68,7 +68,7 @@ if (podname) { | ||
if (!confirm) { | ||
return Promise.reject(new Error('Confirmation failed')); | ||
return Aigle.reject(new Error('Confirmation failed')); | ||
} | ||
return Promise.map(pods, pod => exec(`kubectl delete pod ${pod.name}`)); | ||
return Aigle.map(pods, pod => exec(`kubectl delete pod ${pod.name}`)); | ||
}) | ||
.then(() => console.log('deleted')); | ||
}; |
'use strict'; | ||
const Promise = require('bluebird'); | ||
const exec = Promise.promisify(require('child_process').exec); | ||
const Aigle = require('aigle'); | ||
const exec = Aigle.promisify(require('child_process').exec); | ||
exports.set = function({ project, zone, name }) { | ||
if (!project) { | ||
return Promise.reject(new Error('Project not found')); | ||
} | ||
if (!zone) { | ||
return Promise.reject(new Error('Zone not found')); | ||
} | ||
if (!name) { | ||
return Promise.reject(new Error('Name not found')); | ||
} | ||
console.info(`project: ${project}, name: ${name}, zone: ${zone}`); | ||
return exec(`gcloud container clusters get-credentials ${name} --zone ${zone} --project ${project}`); | ||
if (!project) { | ||
return Aigle.reject(new Error('Project not found')); | ||
} | ||
if (!zone) { | ||
return Aigle.reject(new Error('Zone not found')); | ||
} | ||
if (!name) { | ||
return Aigle.reject(new Error('Name not found')); | ||
} | ||
console.info(`project: ${project}, name: ${name}, zone: ${zone}`); | ||
return exec(`gcloud container clusters get-credentials ${name} --zone ${zone} --project ${project}`); | ||
}; |
{ | ||
"name": "kube-tools", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"description": "", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"bluebird": "^3.4.6", | ||
"aigle": "^0.6.0", | ||
"inquirer": "^1.2.1", | ||
@@ -18,0 +18,0 @@ "lodash": "^4.16.2" |
4957
115
+ Addedaigle@^0.6.0
+ Addedaigle@0.6.1(transitive)
+ Addedaigle-core@0.2.0(transitive)
- Removedbluebird@^3.4.6
- Removedbluebird@3.7.2(transitive)