--version cli argument added to pyright

This commit is contained in:
Oleg Butuzov 2019-05-09 16:41:54 +03:00
parent 43e87c9319
commit 76d464aaad
2 changed files with 11 additions and 0 deletions

View File

@ -10,6 +10,7 @@ Pyright can be run as either a VS Code extension or as a node-based command-line
| -t, --typeshed-path DIRECTORY | Use typeshed type stubs at this location (1) |
| -v, --venv-path DIRECTORY | Directory that contains virtual environments (2) |
| --verbose | Emit verbose diagnostics |
| --version | Print Pyright version |
| -w, --watch | Continue to run and watch for changes (3) |

View File

@ -39,6 +39,7 @@ function processArgs() {
{ name: 'typeshed-path', alias: 't', type: String },
{ name: 'venv-path', alias: 'v', type: String },
{ name: 'verbose', type: Boolean },
{ name: 'version', type: Boolean },
{ name: 'watch', alias: 'w', type: Boolean }
];
@ -62,6 +63,10 @@ function processArgs() {
return;
}
if (args.version !== undefined) {
printVersion();
return;
}
let options = new PyrightCommandLineOptions(process.cwd(), false);
// Assume any relative paths are relative to the working directory.
@ -138,10 +143,15 @@ function printUsage() {
' --stats Print detailed performance stats\n' +
' -t,--typeshed-path DIRECTORY Use typeshed type stubs at this location\n' +
' -v,--venv-path DIRECTORY Directory that contains virtual environments\n' +
' --version Print Pyright version\n' +
' -w,--watch Continue to run and watch for changes\n'
);
}
function printVersion() {
console.log( 'Pyright ' + String(require('package.json').version));
}
function reportDiagnostics(fileDiagnostics: FileDiagnostics[]): number {
let errorCount = 0;
let warningCount = 0;