/* Copyright IBM Corp. 2017 */ import { defer, Observable, of } from 'rxjs'; import { CMD_SHOW } from './../constants'; import { Options } from './../options'; import { VERSION } from './../utils/version'; import { AbstractCommand } from './abstract.command'; import { Command } from './command'; export class ShowVersionCommand extends AbstractCommand implements Command { static readonly TYPE = 'version'; static readonly COMMAND = CMD_SHOW; constructor(private options: Options) { super(options); } printHelp(): void { // log the command line console.log(ShowVersionCommand.COMMAND, ShowVersionCommand.TYPE); } process(): Observable { // defer return defer(() => { // get the version string const version = `version: ${VERSION.version}, build: ${VERSION.build}`; return of(version); }); } }