microsoft/vscode-languagedetection
Publicmirrored fromhttps://github.com/microsoft/vscode-languagedetectionAvailable
cli/index.js
23lines · modecode
| 1 | #!/usr/bin/env node |
| 2 | |
| 3 | const { ModelOperations } = require('../dist/lib/index'); |
| 4 | const os = require('os'); |
| 5 | |
| 6 | (function (params) { |
| 7 | console.warn('Note: this CLI is only for diagnosing the model results in @vscode/vscode-languagedetection. It should not be depended on in any production system.'); |
| 8 | const args = process.argv.slice(2); |
| 9 | const content = args.join(os.EOL); |
| 10 | |
| 11 | if (!content) { |
| 12 | console.error('No content specified. Please pass in the content as the first argument of invocation.'); |
| 13 | return; |
| 14 | } |
| 15 | |
| 16 | if (content.length <= 20) { |
| 17 | console.error('Not enough content specified. Please include more content in your invocation.'); |
| 18 | return; |
| 19 | } |
| 20 | |
| 21 | const modelOperations = new ModelOperations(); |
| 22 | modelOperations.runModel(content).then((result) => console.log(result)); |
| 23 | })(); |
| 24 | |