Skip to content

Commit

Permalink
feat(cli-repl): fix files as positional arguments and add --file MONG…
Browse files Browse the repository at this point in the history
…OSH-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.
  • Loading branch information
addaleax authored May 20, 2021
1 parent bbf2a73 commit 7517f44
Show file tree
Hide file tree
Showing 12 changed files with 728 additions and 623 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ variable. For detailed instructions for each of our supported platforms, please

## CLI Usage
```shell
$ mongosh [options] [db address]
$ mongosh [options] [db address] [file names (ending in .js or .mongodb)]

Options:

Expand Down
2 changes: 1 addition & 1 deletion packages/cli-repl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CLI interface for [MongoDB Shell][mongosh], an extension to Node.js REPL with Mo

## Usage
```shell
$ mongosh [options] [db address]
$ mongosh [options] [db address] [file names (ending in .js or .mongodb)]

Options:

Expand Down
3 changes: 1 addition & 2 deletions packages/cli-repl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
},
"scripts": {
"compile-ts": "tsc -p tsconfig.json",
"start": "node bin/mongosh.js start",
"start-async": "node bin/mongosh.js start --async",
"start": "node bin/mongosh.js",
"pretest": "npm run compile-ts",
"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\"",
"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\"",
Expand Down
Loading

0 comments on commit 7517f44

Please sign in to comment.