WIP
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
import yargs from "yargs";
|
||||
import { hideBin } from "yargs/helpers";
|
||||
import fs from "fs-extra";
|
||||
import { jjConfigsExp } from "./jjConfigUtils";
|
||||
import { getJJConfigByKeyChain, jjConfigsExp } from "./jjConfigUtils";
|
||||
import { dynamicStringHandler } from '@jjHelpers/dynamicStringHandler';
|
||||
|
||||
|
||||
|
||||
@@ -77,13 +78,18 @@ export const jjCliYargs = (cli = true) => {
|
||||
});
|
||||
envsObj[`JJ_CLI_OPTIONS`] = JSON.stringify(allOptionsMap)
|
||||
|
||||
if(!envsObj['JJ_CLI_OPTION_COMMIT']){
|
||||
if (!envsObj['JJ_CLI_OPTION_COMMIT']) {
|
||||
envsObj['JJ_CLI_SELECTED_COMMIT'] = process.env['JJ_WORKSPACE_CURRENT_COMMIT']
|
||||
} else {
|
||||
envsObj['JJ_CLI_SELECTED_COMMIT'] = envsObj['JJ_CLI_OPTION_COMMIT']
|
||||
}
|
||||
|
||||
|
||||
const jjCommandConfig = getJJConfigByKeyChain(`commands['${envsObj['JJ_CLI_ARG_1']}']`)
|
||||
envsObj['JJ_CLI_SCRIPT_TO_RUN_PRE_PATH'] = dynamicStringHandler(`${jjCommandConfig.scriptToRun.prePath}`, "", process.env, false)
|
||||
envsObj['JJ_CLI_SCRIPT_TO_RUN_PATH'] = dynamicStringHandler(`${jjCommandConfig.scriptToRun.path}`, "", process.env, false)
|
||||
envsObj['JJ_CLI_SCRIPT_TO_RUN_TYPE'] = jjCommandConfig.scriptToRun?.type || 'bun'
|
||||
|
||||
if (cli) {
|
||||
Object.keys(envsObj).forEach(envKey => {
|
||||
console.log(`export ${envKey}="${envsObj[envKey]}"`)
|
||||
@@ -102,7 +108,7 @@ export const jjCliYargs = (cli = true) => {
|
||||
}
|
||||
}
|
||||
|
||||
if(process.argv[process.argv.length - 1]== "cli"){
|
||||
if (process.argv[process.argv.length - 1] == "cli") {
|
||||
process.argv.pop()
|
||||
jjCliYargs()
|
||||
}
|
||||
Reference in New Issue
Block a user