Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kube-tools

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kube-tools - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

lib/index.js

4

index.js
'use strict';
const requireDir = require('require-dir');
module.exports = requireDir('./lib', { recurse: true });
module.exports = require('./lib');

@@ -7,3 +7,3 @@ 'use strict';

const pod = require('./pod');
const { pod } = require('./');

@@ -21,5 +21,3 @@ module.exports = function(opts) {

.on('error', err => console.error(err))
.on('close', err => {
console.log('close', err);
});
.on('close', err => console.log('close', err));
logger.stdout.on('data', data => process.stdout.write(data));

@@ -29,4 +27,4 @@ logger.stderr.on('data', data => process.stderr.write(data));

}
return pod(podname)
return pod.get(podname)
.then(execLogger);
};
'use strict';
const _ = require('lodash');
const inquirer = require('inquirer');
const Promise = require('bluebird');
const exec = Promise.promisify(require('child_process').exec);
const prompt = inquirer.createPromptModule();
module.exports = function(podname) {
exports.get = function(podname) {

@@ -19,15 +21,52 @@ const regExp = new RegExp(podname ? `^${podname}` : '');

const keys = _.map(array.shift(), _.toLower);
const list = _.transform(array, (result, items) => {
if (items.length !== keys.length) {
return;
}
const item = _.transform(keys, (result, key, index) => {
result[key] = items[index];
}, {});
if (regExp.test(item.name)) {
result.push(item);
}
});
const list = _.chain(array)
.reject(arr => arr.length !== keys.length)
.map(arr => _.transform(keys, (result, key, index) => result[key] = arr[index], {}))
.filter(pod => regExp.test(pod.name))
.value();
return list;
});
};
exports.delete = function(podname) {
if (!podname) {
console.warn('looking into all pods...');
}
let pods;
return this.get(podname)
.then(_pods => {
pods = _pods;
if (_.isEmpty(pods)) {
return Promise.reject(new Error('Pod not found'));
}
console.log('pod list:');
_.forEach(pods, pod => console.log(`\t[${[pod.name]}]`));
return prompt({
name: 'confirm',
type: 'confirm',
message: 'Do you want to delete the pods?'
});
})
.then(({ confirm }) => {
if (!confirm) {
return Promise.reject(new Error('Confirmation failed'));
}
if (podname) {
return { confirm: true };
}
return prompt({
name: 'confirm',
type: 'confirm',
message: 'Are you sure?'
});
})
.then(({ confirm }) => {
if (!confirm) {
return Promise.reject(new Error('Confirmation failed'));
}
return Promise.map(pods, pod => exec(`kubectl delete pod ${pod.name}`));
})
.then(() => console.log('deleted'));
};
{
"name": "kube-tools",
"version": "0.0.1",
"version": "0.0.2",
"description": "",

@@ -15,5 +15,6 @@ "main": "index.js",

"dependencies": {
"lodash": "^4.16.2",
"require-dir": "^0.3.0"
"bluebird": "^3.4.6",
"inquirer": "^1.2.1",
"lodash": "^4.16.2"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc