vscode-ibmi
vscode-ibmi copied to clipboard
Pase environment variables
Changes
Currently, variables are only replaced before the command is executed. This PR adds local variables as environment variables for pase Actions.
Implements #896
Sample
// action
{
"type": "member",
"extensions": [
"GLOBAL"
],
"environment": "pase",
"name": "Testing envvar",
"command": "echo \"$CURLIB $USERNAME $LIBLC\""
}
# result
Current library: LIAMA
Library list: SAMPLE QDEVTOOLS
Commands:
echo "$CURLIB $USERNAME $LIBLC"
LIAMA linux QDEVTOOLS,SAMPLE
To do
- [ ] Acceptance testing
- [ ] Docs updated
Checklist
- [x] have tested my change
- [ ] updated relevant documentation
- [ ] Remove any/all
console.log
s I added - [ ] eslint is not complaining
- [ ] have added myself to the contributors' list in CONTRIBUTING.md
- [x] for feature PRs: PR only includes one feature enhancement.
@Wright4i @chrjorgensen Any chance either of you could test this out for me?
@worksofliam sure thing. I'll test it tomorrow morning!
Working as expected on my end!
@worksofliam I am about to test this - and had a thought about referencing the variables in the command: It may not be obvious that any variable should be referenced as $VAR when the action screen shows &VAR... Maybe an implicit conversion could be done so the user can specify &VAR as usual and this will be converted to $VAR when sent to PASE?
@worksofliam It also works for my part... however, I see this after saving an ILE action:
/home/NCCJ/Develop/ServiceCommander-IBMi/: /QOpenSys/usr/bin/qsh
liblist -d QGPL QTEMP SYSTEK NCBLIB;liblist -c NCCJ;liblist -a NCCJ NMPAPI GSMTEXT NCCJTESTÅ CHKIBMPTF NCCJTESTÆ NCCJA QGPL QTEMP;system "DSPFFD FILE(*LIBL/ILES.EOL":) OUTPUT(*OUTFILE) OUTFILE(ILEDITOR/RILE514664)"; if [[ $? -ne 0 ]]; then exit 1; fi
{
"code": 2,
"signal": null,
"stdout": "",
"stderr": "qsh: 001-0050 Syntax error on line 1: token \")\" not expected."
}
/home/NCCJ/Develop/ServiceCommander-IBMi/: LC_ALL=EN_US.UTF-8 system "call QSYS/QZDFMDB2 PARM('-d' '-i' '-t')"
SELECT * FROM ILEDITOR.RILE514664
{
"code": 4,
"signal": null,
"stdout": "DB2>\n ?>\n\n **** CLI ERROR *****\n SQLSTATE: 42704\nNATIVE ERROR CODE: -204\nRILE514664 in ILEDITOR type *FILE not found.",
"stderr": ""
}
The strange part is this:
DSPFFD FILE(*LIBL/ILES.EOL":) OUTPUT(*OUTFILE) OUTFILE(ILEDITOR/RILE514664)
Maybe unrelated and a faulty config in my instance, but nevertheless...?
@chrjorgensen i believe that issue is coming from the RPGLE language tools extension and will be fixed in the next release for that (as I just fixed it).
I assume you are still able to save and compile actions like normal?
@chrjorgensen
It may not be obvious that any variable should be referenced as $VAR when the action screen shows &VAR
The user will still be able to use &MYVAR
and that's how we will keep recommending it on the UI (due to a magnitude of reasons). The ability to use the environment variables is something we will document but not mention on the UI yet.
This PR is really to enable the programs that are being called to be able to access these variables as well, not so much from the Action command.
@worksofliam
I assume you are still able to save and compile actions like normal?
Yes, no problem in saving actions - only this "error" in the output screen, when saving an ILE action.
@chrjorgensen I am going to look into that as a separate issue today. Thanks!
@halcyon-tech/core Some further cleanup on this PR today. Any chance we could do some further testing?
Updated docs page here: https://halcyon-tech.github.io/docs/#/pages/developing/local/getting-started?id=pase-environment-variables
I've done further testing and all existing functionality works as expected and new functionality works as expected also.