| 39 | ); |
| 40 | |
| 41 | function printHelp() { |
| 42 | console.log(`Open Chinese Convert (OpenCC) npm Command Line Tool |
| 43 | |
| 44 | Usage: |
| 45 | opencc [options] |
| 46 | |
| 47 | Options: |
| 48 | -c, --config <file> Configuration file. Defaults to s2t.json. |
| 49 | -i, --input <file> Read original text from <file>. Defaults to stdin. |
| 50 | -o, --output <file> Write converted text to <file>. Defaults to stdout. |
| 51 | --include-tofu-risk-dictionaries |
| 52 | Include dictionaries that may output tofu (Chinese |
| 53 | characters rendered as missing-glyph boxes). |
| 54 | -v, --version Print OpenCC version. |
| 55 | -h, --help Print this help. |
| 56 | |
| 57 | Unsupported in the npm CLI: |
| 58 | --inspect Use the native OpenCC CLI for inspection output. |
| 59 | --segmentation Use the native OpenCC CLI for segmentation output. |
| 60 | |
| 61 | Built-in Configurations: |
| 62 | ${BUILT_IN_CONFIGS.map(([name, description]) => ` ${name.padEnd(11)} ${description}`).join('\n')} |
| 63 | `); |
| 64 | } |
| 65 | |
| 66 | function fail(message) { |
| 67 | console.error(message); |