New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

space-cli

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

space-cli - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

lib/helpers.js

11

index.js
#!/usr/bin/env node
const chalk = require('chalk');
const yargs = require('yargs');

@@ -8,2 +7,3 @@

const rocketLaunch = require('./lib/modules/rocketLaunch');
const info = require('./lib/modules/info');

@@ -13,3 +13,3 @@ var argv = yargs

.demandCommand(1)
.command('about', 'Info about the CLI', about)
.command('about', 'Info about the CLI', info.about)
.command('next', 'Get next rocket launch',

@@ -23,2 +23,5 @@ function (yargs) {

describe: 'Define time zone for time info e.g. America/New_York, Europe/Paris, Asia/Shanghai'
}).option('lt', {
alias: 'limit',
describe: 'Define amount of upcoming events to show'
});

@@ -31,5 +34,1 @@ },

.argv;
function about() {
console.log(chalk.green('Welcome to Space CLI'), '- a CLI for space information' + '\n\n' + 'Credits:' + '\n' + 'https://launchlibrary.net/ - API documentation for upcoming launches');
}
const axios = require('axios');
const chalk = require('chalk');
const time = require('./time');
const helpers = require('../helpers');
exports.nextLaunch = function (argv) {
axios.get('https://launchlibrary.net/1.2/launch/next/1').then((response) => {
let next = response.data.launches[0];
let launchCount = argv.limit > 1 ? argv.limit : 1;
axios.get('https://launchlibrary.net/1.2/launch/next/' + launchCount).then((response) => {
let nextCount = response.data.launches.length;
let timezone = argv.timezone;
let timezoneError = false;
let title = chalk.yellow('Next launch:') + ' ' + next.id + ' ' + next.name;
let schedule = chalk.cyan('Scheduled launch attempt:') + ' ' + next.net;
for (let i = 0; i < nextCount; i++) {
let next = response.data.launches[i];
let title = chalk.yellow('Next launch:') + ' ' + next.id + ' ' + next.name;
let schedule = chalk.cyan('Scheduled launch attempt:') + ' ' + next.net;
if (timezone && timezone.length > 0) {
time.convertTimezone(next.net, timezone, function (error, data) {
if (!error) {
schedule = chalk.cyan('Scheduled launch attempt:') + ' ' + data;
return;
}
return console.log(chalk.red(error));
});
}
if (timezone && timezone.length > 0 && !timezoneError) {
helpers.convertTimezone(next.net, timezone, function (error, data) {
if (!error) {
schedule = chalk.cyan('Scheduled launch attempt:') + ' ' + data;
return;
}
timezoneError = true;
return helpers.printMessage(chalk.red(error));
});
}
if (argv.details) {
let broadcasts = chalk.cyan('Broadcasts:') + ' ' + next.vidURLs;
let rocket = chalk.cyan('Rocket:') + ' ' + next.rocket.name;
let dataBreak;
if (nextCount > 1) {
dataBreak = '\n';
}
console.log(title + '\n' + schedule + '\n' + broadcasts + '\n' + rocket);
} else {
console.log(title + '\n' + schedule);
if (argv.details) {
let broadcasts = chalk.cyan('Broadcasts:') + ' ' + next.vidURLs;
let rocket = chalk.cyan('Rocket:') + ' ' + next.rocket.name;
helpers.printMessage(title + '\n' + schedule + '\n' + broadcasts + '\n' + rocket + dataBreak);
} else {
helpers.printMessage(title + '\n' + schedule + dataBreak);
}
}
});
};
{
"name": "space-cli",
"version": "0.3.1",
"version": "0.4.0",
"description": "CLI for space information",

@@ -8,3 +8,3 @@ "main": "index.js",

"lint": "eslint index.js lib/*",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha ./test/**/*.test.js"
},

@@ -35,7 +35,12 @@ "keywords": [

"devDependencies": {
"chai": "^3.5.0",
"eslint": "^3.18.0",
"eslint-config-standard": "^7.1.0",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^2.1.1"
"eslint-plugin-standard": "^2.1.1",
"mocha": "^3.2.0",
"moxios": "^0.3.0",
"sinon": "^2.1.0",
"sinon-chai": "^2.9.0"
}
}

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