| 7 | const { verifyProjectTelemetry } = require('../core/telemetry/integrity'); |
| 8 | |
| 9 | function parseArgs(argv) { |
| 10 | const args = { |
| 11 | projectRoot: process.cwd(), |
| 12 | json: false, |
| 13 | strictLegacy: false, |
| 14 | }; |
| 15 | |
| 16 | for (let index = 2; index < argv.length; index++) { |
| 17 | const arg = argv[index]; |
| 18 | const value = argv[index + 1]; |
| 19 | if (arg === '--project-root') { args.projectRoot = path.resolve(value); index++; } |
| 20 | else if (arg === '--file') { |
| 21 | args.files = [...(args.files || []), path.resolve(args.projectRoot, value)]; |
| 22 | index++; |
| 23 | } else if (arg === '--json') args.json = true; |
| 24 | else if (arg === '--strict-legacy') args.strictLegacy = true; |
| 25 | else if (arg === '--help' || arg === '-h') args.help = true; |
| 26 | } |
| 27 | |
| 28 | return args; |
| 29 | } |
| 30 | |
| 31 | function usage() { |
| 32 | return [ |