33 * This program and the accompanying materials are made available and may be used, at your option, under either:
44 * - Eclipse Public License v2.0, available at https://www.eclipse.org/legal/epl-v20.html, OR
55 * - Apache License, version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
6- *
6+ *
77 * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
8- *
8+ *
99 * Copyright Contributors to the Zowe Project.
10- *
10+ *
1111 */
1212
1313import * as config from "config" ;
@@ -24,25 +24,25 @@ const inputSource: string = process.argv[2];
2424if ( inputSource ) uploadSource ( inputSource , pdsName ) ;
2525
2626async function uploadSource ( filePath : string , pdsName : string ) {
27- if ( existsSync ( filePath ) ) {
28- const memberName = basename ( filePath , extname ( filePath ) ) ;
29- const zosTarget = `${ pdsName } (${ memberName } )` ;
30- issueUploadCommand ( filePath , zosTarget )
31- . then ( ( output ) => console . log ( output ) )
32- . catch ( ( err ) => console . error ( err ) ) ;
33- } else {
34- console . error ( `Input source path not found: ${ filePath } ` ) ;
35- }
27+ if ( existsSync ( filePath ) ) {
28+ const memberName = basename ( filePath , extname ( filePath ) ) ;
29+ const zosTarget = `${ pdsName } (${ memberName } )` ;
30+ issueUploadCommand ( filePath , zosTarget )
31+ . then ( ( output ) => console . log ( output ) )
32+ . catch ( ( err ) => console . error ( err ) ) ;
33+ } else {
34+ console . error ( `Input source path not found: ${ filePath } ` ) ;
35+ }
3636}
3737
3838function issueUploadCommand ( localFile : string , dataSet : string ) {
39- return new Promise ( ( resolve , reject ) => {
40- const cmd = `zowe files upload ftds "${ localFile } " "${ dataSet } "` ;
41- console . log ( `Uploading file ${ localFile } to PDS ${ dataSet } ` ) ;
42- exec ( cmd , ( err , stdout , stderr ) => {
43- if ( err ) reject ( err ) ;
44- if ( stdout ) resolve ( stdout . toString ( ) ) ;
45- if ( stderr ) reject ( stderr . toString ( ) ) ;
46- } ) ;
39+ return new Promise ( ( resolve , reject ) => {
40+ const cmd = `zowe files upload ftds "${ localFile } " "${ dataSet } "` ;
41+ console . log ( `Uploading file ${ localFile } to PDS ${ dataSet } ` ) ;
42+ exec ( cmd , ( err , stdout , stderr ) => {
43+ if ( err ) reject ( err ) ;
44+ if ( stdout ) resolve ( stdout . toString ( ) ) ;
45+ if ( stderr ) reject ( stderr . toString ( ) ) ;
4746 } ) ;
47+ } ) ;
4848}
0 commit comments