modified env vars and output texts

This commit is contained in:
Marius Pana 2018-02-10 18:36:28 +02:00
parent d589694608
commit 71f5d9568e

View File

@ -58,9 +58,9 @@ var OPTIONS = [
names: ['profile', 'p'],
type: 'string',
completionType: 'tritonprofile',
env: 'TRITON_PROFILE',
env: 'SC_PROFILE',
helpArg: 'NAME',
help: 'Triton client profile to use.'
help: 'Spearhead Cloud client profile to use.'
},
{
@ -81,8 +81,7 @@ var OPTIONS = [
{
names: ['account', 'a'],
type: 'string',
help: 'Account (login name). Environment: TRITON_ACCOUNT=ACCOUNT ' +
'or SDC_ACCOUNT=ACCOUNT.',
help: 'Account (login name). Environment: SC_ACCOUNT=ACCOUNT ',
helpArg: 'ACCOUNT'
},
{
@ -90,51 +89,48 @@ var OPTIONS = [
type: 'string',
help: 'Masquerade as the given account login name. This can only ' +
'succeed for operator accounts. Note that accesses like these ' +
'audited on the CloudAPI server side.',
'are audited on the CloudAPI server side.',
helpArg: 'ACCOUNT',
hidden: true
},
{
names: ['user', 'u'],
type: 'string',
help: 'RBAC user (login name). Environment: TRITON_USER=USER ' +
'or SDC_USER=USER.',
help: 'RBAC user (login name). Environment: SC_USER=USER',
helpArg: 'USER'
},
{
names: ['role', 'r'],
type: 'arrayOfCommaSepString',
env: 'TRITON_ROLE',
env: 'SC_ROLE',
help: 'Assume an RBAC role. Use multiple times or once with a list',
helpArg: 'ROLE,...'
},
{
names: ['keyId', 'k'],
type: 'string',
help: 'SSH key fingerprint. Environment: TRITON_KEY_ID=FINGERPRINT ' +
'or SDC_KEY_ID=FINGERPRINT.',
help: 'SSH key fingerprint. Environment: SC_KEY_ID=FINGERPRINT.',
helpArg: 'FP'
},
{
names: ['url', 'U'],
type: 'string',
help: 'CloudAPI URL. Environment: TRITON_URL=URL or SDC_URL=URL.',
help: 'Spearhead Cloud Datacenter URL. Environment: SC_URL=URL.',
helpArg: 'URL'
},
{
names: ['J'],
type: 'string',
hidden: true,
help: 'Joyent Public Cloud (JPC) datacenter name. This is ' +
'a shortcut to the "https://$dc.api.joyent.com" ' +
help: 'Spearhead Cloud (SC) datacenter name. This is ' +
'a shortcut to the "https://$dc.api.spearhead.cloud" ' +
'cloudapi URL.'
},
{
names: ['insecure', 'i'],
type: 'bool',
help: 'Do not validate the CloudAPI SSL certificate. Environment: ' +
'TRITON_TLS_INSECURE=1, SDC_TLS_INSECURE=1 (or the deprecated ' +
'SDC_TESTING=1).',
help: 'Do not validate the SSL certificate. Environment: ' +
'SC_TLS_INSECURE=1 (or the deprecated SC_TESTING=1).',
'default': false
},
{
@ -143,7 +139,7 @@ var OPTIONS = [
helpArg: 'VER',
help: 'A cloudapi API version, or semver range, to attempt to use. ' +
'This is passed in the "Accept-Version" header. ' +
'See `triton cloudapi /--ping` to list supported versions. ' +
'See `spearhead cloudapi /--ping` to list supported versions. ' +
'The default is "' + lib_tritonapi.CLOUDAPI_ACCEPT_VERSION + '". ' +
'*This is intended for development use only. It could cause ' +
'`triton` processing of responses to break.*',
@ -258,7 +254,7 @@ CLI.prototype.init = function (opts, args, callback) {
callback(new errors.UsageError(
'cannot use both "--url" and "-J" options'));
} else if (opts.J) {
opts.url = format('https://%s.api.joyent.com', opts.J);
opts.url = format('https://%s.api.spearhead.cloud', opts.J);
}
this.configDir = constants.CLI_CONFIG_DIR;
@ -298,9 +294,8 @@ CLI.prototype.init = function (opts, args, callback) {
/* BEGIN JSSTYLED */
pErr.message += '\n'
+ ' No profile information could be loaded.\n'
+ ' Use "triton profile create" to create a profile or provide\n'
+ ' the required "CloudAPI options" described in "triton --help".\n'
+ ' See https://github.com/joyent/node-triton#setup for more help.';
+ ' Use "spearhead profile create" to create a profile or provide\n'
+ ' the required "CloudAPI options" described in "spearhead --help".';
/* END JSSTYLED */
}
throw pErr;
@ -322,9 +317,9 @@ CLI.prototype.init = function (opts, args, callback) {
return self._tritonapi;
});
if (process.env.TRITON_COMPLETE) {
if (process.env.SC_COMPLETE) {
/*
* If `TRITON_COMPLETE=<type>` is set (typically only in the
* If `SC_COMPLETE=<type>` is set (typically only in the
* Triton CLI bash completion driver, see
* "etc/triton-bash-completion-types.sh"), then Bash completions are
* fetched and printed, instead of the usual subcommand handling.
@ -333,9 +328,9 @@ CLI.prototype.init = function (opts, args, callback) {
* to avoid hitting the server for data everytime.
*
* Example usage:
* TRITON_COMPLETE=images triton -p my-profile create
* SC_COMPLETE=images triton -p my-profile create
*/
self._emitCompletions(process.env.TRITON_COMPLETE, function (err) {
self._emitCompletions(process.env.SC_COMPLETE, function (err) {
callback(err || false);
});
} else {
@ -559,7 +554,7 @@ CLI.prototype._emitCompletions = function _emitCompletions(type, cb) {
});
break;
default:
process.stderr.write('warning: unknown triton completion type: '
process.stderr.write('warning: unknown spearhead completion type: '
+ type + '\n');
next();
break;