Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6433334

Browse filesBrowse files
committed
replaces __name__ with __env object
1 parent 303a0d5 commit 6433334
Copy full SHA for 6433334

File tree

Expand file treeCollapse file tree

3 files changed

+8
-3
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+8
-3
lines changed

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jspython-cli",
3-
"version": "2.1.17",
3+
"version": "2.1.18",
44
"description": "CLI for jspython. Allows you to run jspython (*.jspy) files",
55
"main": "./lib/public-api.js",
66
"bin": {

‎src/cli.ts

Copy file name to clipboardExpand all lines: src/cli.ts
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function getOptionsFromArguments(rawArgs: string[]): InterpreterOptions {
7575
async function main() {
7676
const options = getOptionsFromArguments(process.argv);
7777
const interpreter: Interpreter = (await jsPythonForNode(options)) as Interpreter;
78-
const jspyContext: Record<string, any> = { ...initialScope, ...{ args: options.params } };
78+
const jspyContext: Record<string, any> = { ...initialScope };
7979

8080
if (options.version) {
8181
console.log(interpreter.jsPythonInfo());
@@ -123,6 +123,12 @@ async function main() {
123123
const scripts = fs.readFileSync(fileName, 'utf8');
124124
console.log(interpreter.jsPythonInfo());
125125
console.log(`> ${options.file}`);
126+
jspyContext.__env = {
127+
args: options.params,
128+
entryFunction: options.entryFunction || '',
129+
entryModule: options.file,
130+
runsAt: 'jspython-cli'
131+
};
126132
try {
127133
const res = await interpreter.evaluate(
128134
scripts,

‎src/jspython-node.ts

Copy file name to clipboardExpand all lines: src/jspython-node.ts
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { trimChar } from './utils';
66

77
const rootFolder = process.cwd().split('\\').join('/');
88
export const initialScope: any = {
9-
__name__: 'main',
109
session: {},
1110
asserts: [] as AssertInfo[]
1211
};

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.