Skip to content

Commit 7517f44

Browse files
authored
feat(cli-repl): fix files as positional arguments and add --file MONGOSH-769 (#890)
- If the first positional argument ends in .mongodb or .js and is not a connection string, treat it as a filename. - Add a `--file` (`-f`) flag for specifying filenames that avoids this ambiguity. - Internally, avoid referring to positional arguments in general and be specific about whether the connection specifier or the filenames are being accessed - As drive-by fixes, fix the spelling of `tlsAllowInvalidHostname` and drop the extra unnecessary `start` argument handling.
1 parent bbf2a73 commit 7517f44

File tree

12 files changed

+728
-623
lines changed

12 files changed

+728
-623
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ variable. For detailed instructions for each of our supported platforms, please
2424

2525
## CLI Usage
2626
```shell
27-
$ mongosh [options] [db address]
27+
$ mongosh [options] [db address] [file names (ending in .js or .mongodb)]
2828

2929
Options:
3030

packages/cli-repl/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CLI interface for [MongoDB Shell][mongosh], an extension to Node.js REPL with Mo
66

77
## Usage
88
```shell
9-
$ mongosh [options] [db address]
9+
$ mongosh [options] [db address] [file names (ending in .js or .mongodb)]
1010

1111
Options:
1212

packages/cli-repl/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
},
2020
"scripts": {
2121
"compile-ts": "tsc -p tsconfig.json",
22-
"start": "node bin/mongosh.js start",
23-
"start-async": "node bin/mongosh.js start --async",
22+
"start": "node bin/mongosh.js",
2423
"pretest": "npm run compile-ts",
2524
"test": "cross-env TS_NODE_PROJECT=../../config/tsconfig.test.json mocha -r \"../../scripts/import-expansions.js\" --timeout 60000 --colors -r ts-node/register \"./{src,test}/**/*.spec.ts\"",
2625
"test-ci": "cross-env TS_NODE_PROJECT=../../config/tsconfig.test.json mocha -r \"../../scripts/import-expansions.js\" --timeout 60000 -r ts-node/register \"./{src,test}/**/*.spec.ts\"",

0 commit comments

Comments
 (0)