cli-stash
Version:
CLI application to manage and work with Atlassian Stash. Work with your Stash project and repositories from Command lines.
45 lines (44 loc) • 1.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const stash_connector_1 = require("stash-connector");
const baseCommand_1 = require("../../libs/core/baseCommand");
const stashResponse_1 = require("../../libs/core/stashResponse");
const tables_1 = require("../../libs/core/tables");
const ux_1 = require("../../libs/core/ux");
class Cluster extends baseCommand_1.BaseCommand {
async run() {
const response = new stashResponse_1.StashCLIResponse();
const connector = new stash_connector_1.StashConnector(this.localConfig.getConnectorOptions(this.flags.alias));
try {
const clusters = await connector.admin.cluster();
response.result = clusters;
response.status = 0;
this.ux.log('RUNNING: ' + clusters.running);
this.ux.log('\n------------------------------------\n');
this.ux.log('LOCAL NODE:');
this.ux.table([clusters.localNode], tables_1.ClusterNodeColumns, {
csv: this.flags.csv
});
this.ux.log('\n------------------------------------\n');
this.ux.log('NODES:');
this.ux.table(clusters.nodes, tables_1.ClusterNodeColumns, {
csv: this.flags.csv
});
}
catch (error) {
this.processError(response, error);
}
return response;
}
}
exports.default = Cluster;
Cluster.description = 'Gets information about the nodes that currently make up the stash cluster. ' + ux_1.UX.processDocumentation('<doc:ClusterOutput>');
Cluster.examples = [
`$ stash admin:cluster`,
`$ stash admin:cluster --json`,
];
Cluster.flags = {
...baseCommand_1.BaseCommand.flags,
csv: baseCommand_1.BuildFlags.csv,
alias: baseCommand_1.BuildFlags.alias,
};