Permalink
Browse files

feat(cli): add --version, also a warning about passwords

  • Loading branch information...
RangerRick committed Aug 7, 2017
1 parent 0f7e456 commit 1c07be9e541253af7717240825f73a7586f30e12
Showing with 11 additions and 1 deletion.
  1. +9 −1 src/CLI.ts
  2. +2 −0 webpack.config.js
View
@@ -12,6 +12,7 @@ import {
/** @hidden */
const CLI = () => {
const version = 'OPENNMS_JS_VERSION';
const catCLI = new Category('cli', catRoot);
// tslint:disable
@@ -90,7 +91,11 @@ const CLI = () => {
.option('-d, --debug', 'Enable debug output', () => {
setLogLevel(LogLevel.Debug);
})
.option('-c, --config <file>', 'Specify a configuration file (default: ~/.opennms-cli.config.json)');
.option('-c, --config <file>', 'Specify a configuration file (default: ~/.opennms-cli.config.json)')
.option('-v, --version', 'Print the OpenNMS.js version and exit', () => {
console.log(version);
process.exit(0);
});
// connect (validate server and save config)
program
@@ -99,6 +104,8 @@ const CLI = () => {
.option('-u, --username <username>', 'The username to authenticate as (default: admin)')
.option('-p, --password <password>', 'The password to authenticate with (default: admin)')
.action((url, options) => {
console.log(colors.red('WARNING: This command saves your login'
+ ' information to ~/.opennms-cli.config.json in clear text.'));
const config = readConfig();
if (url) {
// the user is passing a URL, reset the config
@@ -334,6 +341,7 @@ const CLI = () => {
if (!process.argv.slice(2).length) {
program.outputHelp();
process.exit(0);
}
};
View
@@ -1,6 +1,7 @@
var webpack = require('webpack');
var path = require('path');
var TypedocWebpackPlugin = require('typedoc-webpack-plugin');
var pkginfo = require('./package.json');
var createVariants = require('parallel-webpack').createVariants;
@@ -89,6 +90,7 @@ function createConfig(options) {
var defs = {
'IS_WEB': options.target === 'web',
'IS_PRODUCTION': options.production,
'OPENNMS_JS_VERSION': pkginfo.version,
};
if (options.target === 'web') {

0 comments on commit 1c07be9

Please sign in to comment.