| 15 | ]; |
| 16 | |
| 17 | function printHelp() { |
| 18 | console.log(`Usage: |
| 19 | npm run sidebar:check |
| 20 | npm run sidebar:sync |
| 21 | node scripts/sync-sidebar.js [options] |
| 22 | |
| 23 | Options: |
| 24 | --write Rewrite sidebar.ts. Default is dry-run only. |
| 25 | --check Exit with code 1 if sidebar.ts is out of sync. |
| 26 | --sidebar <path> Sidebar file. Default: docs/src/.vuepress/sidebar.ts |
| 27 | --route <route> Route to sync, for example /sidebar/itwanger/ai/ |
| 28 | --dir <path> Markdown directory for --route. |
| 29 | --fallback <text> Group text for new files. Default: 其他 |
| 30 | --verbose Print unchanged targets too. |
| 31 | --help Show this help. |
| 32 | |
| 33 | Without --route/--dir, the script syncs the built-in targets: |
| 34 | ${DEFAULT_TARGETS.map((target) => ` - ${target.route} <= ${target.dir}`).join("\n")} |
| 35 | `); |
| 36 | } |
| 37 | |
| 38 | function parseArgs(argv) { |
| 39 | const options = { |