Created
January 31, 2020 05:30
-
-
Save plavjanik/dc57e970027b132d7f390bd30752056b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Command, flags } from "@oclif/command"; | |
| import * as logSymbols from "log-symbols"; | |
| import { readConfiguration, ITransferredFile } from "../config"; | |
| import { transferFiles } from "../files"; | |
| import { checkZowe } from "../zowe"; | |
| import { basename } from 'path'; | |
| export default class Upload extends Command { | |
| static description = "upload a single file to z/OS"; | |
| static flags = { | |
| force: flags.boolean({ char: "f", description: "forces full deployment even if there is no change", default: false }), | |
| sourcePath: flaags.string({ char: "s", default: "", helpValue: "<sourcePath>", description: "source file path" }), | |
| zosTargetDir: flags.string({ char: "d", default: "", helpValue: "<zosTargetDir>", description: "z/OS target directory" }), | |
| }; | |
| async run() { | |
| const f = this.parse(Upload).flags; | |
| const [userConfig, _] = readConfiguration(this); | |
| checkZowe(this); | |
| const files: { [id: string] : ITransferredFile; } = {}; | |
| files[f.sourcePath] = { | |
| binary: true, | |
| postCommands: [], | |
| postSoUpdateCommands: [], | |
| target: basename(f.sourcePath), | |
| template: false, | |
| }; | |
| transferFiles(files, f.zosTargetDir, userConfig, this, f.force); | |
| this.log(logSymbols.success, "Upload to z/OS completed"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment