import { AbstractSession , IHandlerParameters , TextUtils } from "@zowe/imperative" ; import { IZosFilesResponse , List } from "@zowe/zos-files-for-zowe-sdk" ; import { ZosFilesBaseHandler } from "../../ZosFilesBase.handler" ; export export default class DataSetHandler extends ZosFilesBaseHandler { public async processWithSession ( commandParameters , session ) { const response = await List . dataSet ( session , commandParameters . arguments . dataSetName , { volume : commandParameters . arguments . volumeSerial , attributes : commandParameters . arguments . attributes , maxLength : commandParameters . arguments . maxLength , responseTimeout : commandParameters . arguments . responseTimeout , start : commandParameters . arguments . start } ) ; if ( commandParameters . arguments . attributes && response . apiResponse . items . length > 0 ) { commandParameters . response . console . log ( TextUtils . prettyJson ( response . apiResponse . items ) ) ; } else { const dsnameList = response . apiResponse . items . map ( ( mem ) => mem . dsname ) ; commandParameters . response . console . log ( dsnameList . join ( "\n" ) ) ; } return response ; } }