Skip to content

How to implement Import.Handler #1589

Answered by t1m0thyj
MichaelSmoor asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @MichaelSmoor, typically we don't recommend calling handlers directly, but for this use case I think it makes sense since we currently don't have an SDK method that exposes the config import functionality. As you have discovered, the command handlers only run in an environment where Zowe CLI has preloaded certain values like the ICommandParameters interface and ImperativeConfig.instance object.

I believe this code should work - it's mostly the same as the snippet you shared, with the addition of initializing the Config class:

const imperative = require("./lib");
const ImportHandler = require("./lib/imperative/src/config/cmd/import/import.handler").default;

(async () => {
    impera…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MichaelSmoor
Comment options

Answer selected by MichaelSmoor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants