### Prepare Input Data Example Source: https://github.com/studyzy/imewlconverter/blob/master/tests/integration/docs/adding-tests.md Example configuration for input data, specifying file and format. ```yaml input: file: "../../../../src/ImeWlConverterCoreTest/Test/示例词库.scel" format: "sougou" ``` -------------------------------- ### Test Framework Update Example Source: https://github.com/studyzy/imewlconverter/blob/master/docs/MIGRATION.md Example of updating command construction in test scripts. ```bash CMD="dotnet ImeWlConverterCmd.dll -i:$INPUT_FORMAT -o:$OUTPUT_FORMAT" ``` ```bash CMD="imewlconverter -i $INPUT_FORMAT -o $OUTPUT_FORMAT -O $OUTPUT_PATH" ``` -------------------------------- ### Using Filter Source: https://github.com/studyzy/imewlconverter/blob/master/docs/MIGRATION.md Example of using the filter option. ```bash -ft:"len:1-100|rank:2-9999|rm:eng|rm:num" ``` ```bash --filter "len:1-100|rank:2-9999|rm:eng|rm:num" # or -f "len:1-100|rank:2-9999|rm:eng|rm:num" ``` -------------------------------- ### Batch Conversion to Directory Source: https://github.com/studyzy/imewlconverter/blob/master/docs/MIGRATION.md Example of batch converting files to a directory. ```bash dotnet ImeWlConverterCmd.dll -i:scel ./test/*.scel -o:ggpy ./temp/* ``` ```bash imewlconverter -i scel -o ggpy -O ./temp/ *.scel ``` -------------------------------- ### Full usage example: Clone and build Source: https://github.com/studyzy/imewlconverter/blob/master/README.md Steps to clone the repository and build the CLI tool. ```bash # 1. 克隆并构建 git clone https://github.com/studyzy/imewlconverter.git cd imewlconverter dotnet build src/ImeWlConverterCmd ``` -------------------------------- ### Migration Example: Old vs. New Format Source: https://github.com/studyzy/imewlconverter/blob/master/openspec/changes/archive/2026-01-31-refactor-cmd-args-format/specs/cmd-args-parsing/spec.md Demonstrates the transition from the old colon-separated argument format to the new GNU-style format, including examples with both long and short options. ```bash # 旧格式 dotnet ImeWlConverterCmd.dll -i:scel input.scel -o:ggpy output.txt # 新格式 imewlconverter --input-format scel --output-format ggpy --output output.txt input.scel # 或使用短选项 imewlconverter -i scel -o ggpy -O output.txt input.scel ``` -------------------------------- ### Multi-file Conversion Source: https://github.com/studyzy/imewlconverter/blob/master/docs/MIGRATION.md Example of converting multiple input files. ```bash dotnet ImeWlConverterCmd.dll -i:scel ./test.scel ./a.scel -o:ggpy ./gg.txt ``` ```bash imewlconverter -i scel -o ggpy -O output.txt test.scel a.scel ``` -------------------------------- ### Full usage example: Using dotnet run Source: https://github.com/studyzy/imewlconverter/blob/master/README.md Alternative method to run the conversion using 'dotnet run', avoiding the need to specify the DLL path. ```bash cd imewlconverter dotnet run --project src/ImeWlConverterCmd -- \ -i scel -o sgpy -O 唐诗300首.txt \ "src/ImeWlConverterCoreTest/Test/唐诗300首【官方推荐】.scel" ``` -------------------------------- ### 编码文件选项 Source: https://github.com/studyzy/imewlconverter/blob/master/openspec/specs/cmd-args-parsing/spec.md Example of using the code file option. ```bash --code-file ``` ```bash -c ``` -------------------------------- ### Basic Conversion Source: https://github.com/studyzy/imewlconverter/blob/master/docs/MIGRATION.md Example of converting basic input and output formats. ```bash dotnet ImeWlConverterCmd.dll -i:scel input.scel -o:ggpy output.txt ``` ```bash # Using long options imewlconverter --input-format scel --output-format ggpy --output output.txt input.scel # Using short options (recommended) imewlconverter -i scel -o ggpy -O output.txt input.scel ``` -------------------------------- ### Python Script Update Source: https://github.com/studyzy/imewlconverter/blob/master/docs/MIGRATION.md Example of updating a Python script for the new format. ```python import subprocess subprocess.run([ "dotnet", "ImeWlConverterCmd.dll", "-i:scel", "input.scel", "-o:ggpy", "output.txt" ]) ``` ```python import subprocess subprocess.run([ "imewlconverter", "-i", "scel", "-o", "ggpy", "-O", "output.txt", "input.scel" ]) ``` -------------------------------- ### 目标操作系统选项 Source: https://github.com/studyzy/imewlconverter/blob/master/openspec/specs/cmd-args-parsing/spec.md Example of using the target OS option. ```bash --target-os ``` -------------------------------- ### 输入格式选项 Source: https://github.com/studyzy/imewlconverter/blob/master/openspec/specs/cmd-args-parsing/spec.md Example of using the input format option. ```bash --input-format ``` ```bash -i ``` -------------------------------- ### Shell Script Update Source: https://github.com/studyzy/imewlconverter/blob/master/docs/MIGRATION.md Example of updating a shell script for the new format. ```bash #!/bin/bash for file in *.scel; do dotnet ImeWlConverterCmd.dll -i:scel "$file" -o:ggpy "${file%.scel}.txt" done ``` ```bash #!/bin/bash for file in *.scel; do imewlconverter -i scel -o ggpy -O "${file%.scel}.txt" "$file" done ``` -------------------------------- ### Rime Output Configuration Source: https://github.com/studyzy/imewlconverter/blob/master/docs/MIGRATION.md Example of configuring code type and target OS. ```bash -ct:pinyin -os:macos ``` ```bash --code-type pinyin --target-os macos # or -t pinyin --target-os macos ```