import { IHandlerParameters } from "@zowe/imperative" ; import { DefinitionWorkflow , IWorkflowDefinition } from "@zowe/zos-workflows-for-zowe-sdk" ; import { ZosmfBaseHandler } from "@zowe/zosmf-for-zowe-sdk" ; /**
 * Common Handler for retrieving the contents of a z/OSMF workflow definition from a z/OS system.
 */ export default class ListActiveWorkflowsHandler extends ZosmfBaseHandler { private type { * } memberof private arguments : any ; param { IHandlerParameters } params returns { Promise < void > } memberof public async processCmd ( commandParameters ) { this . arguments = commandParameters . arguments ; let response ; let error ; try { response = await DefinitionWorkflow . getWorkflowDefinition ( this . mSession , undefined , this . arguments . definitionFilePath , this . arguments . listSteps , this . arguments . listVariables ) ; } catch ( err ) { error = "List workflow(s) " + err ; throw error ; } commandParameters . response . data . setObj ( response ) ; commandParameters . response . console . log ( "\nWorkflow Details: " ) ; commandParameters . response . format . output ( { fields : [ "workflowDefaultName" , "workflowDescription" , "workflowID" ] , output : response , format : "object" } ) ; if ( this . arguments . listSteps && response . steps ) { commandParameters . response . console . log ( "\nWorkflow Steps: " ) ; commandParameters . response . format . output ( { fields : [ "name" , "title" , "description" ] , output : response . steps , format : "table" , header : true } ) ; } if ( this . arguments . listVariables && response . variables ) { commandParameters . response . console . log ( "\nWorkflow Variables: " ) ; commandParameters . response . format . output ( { fields : [ "name" , "description" , "type" ] , output : response . variables , format : "table" , header : true } ) ; } } }