kui-shell
Version:
This is the monorepo for Kui, the hybrid command-line/GUI electron-based Kubernetes tool
31 lines • 977 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const settings_1 = require("../core/settings");
function parseCommandContext(str) {
if (str) {
try {
return JSON.parse(str);
}
catch (err1) {
try {
return str.split('/').filter(_ => _);
}
catch (err2) {
console.error(`Could not parse command context ${str}`, err1, err2);
}
}
}
return undefined;
}
let _defaultContext = parseCommandContext(process.env.KUI_COMMAND_CONTEXT) || (settings_1.theme && settings_1.theme.defaultContext) || [];
exports.Context = {
current: _defaultContext
};
exports.setDefaultCommandContext = (commandContext) => {
exports.Context.current = _defaultContext = commandContext;
};
function getCurrentContext() {
return exports.Context.current;
}
exports.getCurrentContext = getCurrentContext;
//# sourceMappingURL=context.js.map