已开启
【社区学习赛】docs:更新文件README_zh.md #1267
2501_93903314创建于 28 天前
【社区学习赛】docs:更新文件README_zh.md #1267
已开启
2501_93903314创建于 28 天前
共 1 个文件变更+10-10
@@ -114,7 +114,7 @@ void PrintHelp()
114 Println(" -l <region> Only format lines in the specified region for the provided file. Only valid if a single "114 Println(" -l <region> Only format lines in the specified region for the provided file. Only valid if a single "
115 "file was specified.");115 "file was specified.");
116 Println(" Region has a format of [start:end] where 'start' and 'end' are integer numbers "116 Println(" Region has a format of [start:end] where 'start' and 'end' are integer numbers "
117- "representing first and last lines to be formated in the specified file.");117+ "representing first and last lines to be formatted in the specified file.");
118 Println(" Line count starts with 1.");118 Println(" Line count starts with 1.");
119 Println(" eg: cjfmt -f a.cj -o ./fmta.cj -l 1:25");119 Println(" eg: cjfmt -f a.cj -o ./fmta.cj -l 1:25");
120}120}
@@ -222,9 +222,9 @@ void SetOptionLineBreakType(TomlParser& parser, FormattingOptions& options)
222 options.newLine = *lineBreakType == "CRLF" ? "\r\n" : "\n";222 options.newLine = *lineBreakType == "CRLF" ? "\r\n" : "\n";
223}223}
224 224 
225-void SetOptionMethodChainning(TomlParser& parser, FormattingOptions& options)225+void SetOptionMethodChaining(TomlParser& parser, FormattingOptions& options)
226{226{
227- auto methodChainningOptional = parser.GetValue("allowMultiLineMethodChain");227+ auto methodChainingOptional = parser.GetValue("allowMultiLineMethodChain");
228 if (!methodChainningOptional.has_value()) {228 if (!methodChainningOptional.has_value()) {
229 Warningln("Can't find configuration option: allowMultiLineMethodChain, "229 Warningln("Can't find configuration option: allowMultiLineMethodChain, "
230 "built-in options will be used: allowMultiLineMethodChain = false");230 "built-in options will be used: allowMultiLineMethodChain = false");
@@ -241,7 +241,7 @@ void SetOptionMethodChainning(TomlParser& parser, FormattingOptions& options)
241 "Built-in options will be used: allowMultiLineMethodChain = false");241 "Built-in options will be used: allowMultiLineMethodChain = false");
242 }242 }
243 },243 },
244- methodChainningOptional.value());244+ methodChainingOptional.value());
245 if (!allowMultiLineMethodChain.has_value()) {245 if (!allowMultiLineMethodChain.has_value()) {
246 return;246 return;
247 }247 }
@@ -250,7 +250,7 @@ void SetOptionMethodChainning(TomlParser& parser, FormattingOptions& options)
250 250 
251void SetOptionMethodChainLevel(TomlParser& parser, FormattingOptions& options)251void SetOptionMethodChainLevel(TomlParser& parser, FormattingOptions& options)
252{252{
253- auto methodChainningOptional = parser.GetValue("multipleLineMethodChainLevel");253+ auto methodChainingOptional = parser.GetValue("multipleLineMethodChainLevel");
254 if (!methodChainningOptional.has_value()) {254 if (!methodChainningOptional.has_value()) {
255 Warningln("Can't find configuration option: multipleLineMethodChainLevel, "255 Warningln("Can't find configuration option: multipleLineMethodChainLevel, "
256 "built-in options will be used: multipleLineMethodChainLevel = 5");256 "built-in options will be used: multipleLineMethodChainLevel = 5");
@@ -267,7 +267,7 @@ void SetOptionMethodChainLevel(TomlParser& parser, FormattingOptions& options)
267 "Built-in options will be used: multipleLineMethodChainLevel = 5");267 "Built-in options will be used: multipleLineMethodChainLevel = 5");
268 }268 }
269 },269 },
270- methodChainningOptional.value());270+ methodChainingOptional.value());
271 if (!multipleLineMethodChainLevel.has_value()) {271 if (!multipleLineMethodChainLevel.has_value()) {
272 return;272 return;
273 }273 }
@@ -282,7 +282,7 @@ void SetOptionMethodChainLevel(TomlParser& parser, FormattingOptions& options)
282 282 
283void SetOptionMultipleLineMethodChainOverLineLength(TomlParser& parser, FormattingOptions& options)283void SetOptionMultipleLineMethodChainOverLineLength(TomlParser& parser, FormattingOptions& options)
284{284{
285- auto methodChainningOptional = parser.GetValue("multipleLineMethodChainOverLineLength");285+ auto methodChainingOptional = parser.GetValue("multipleLineMethodChainOverLineLength");
286 if (!methodChainningOptional.has_value()) {286 if (!methodChainningOptional.has_value()) {
287 Warningln("Can't find configuration option: multipleLineMethodChainOverLineLength, "287 Warningln("Can't find configuration option: multipleLineMethodChainOverLineLength, "
288 "built-in options will be used: multipleLineMethodChainOverLineLength = true");288 "built-in options will be used: multipleLineMethodChainOverLineLength = true");
@@ -299,7 +299,7 @@ void SetOptionMultipleLineMethodChainOverLineLength(TomlParser& parser, Formatti
299 "Built-in options will be used: multipleLineMethodChainOverLineLength = true");299 "Built-in options will be used: multipleLineMethodChainOverLineLength = true");
300 }300 }
301 },301 },
302- methodChainningOptional.value());302+ methodChainingOptional.value());
303 if (!multipleLineMethodChainOverLineLength.has_value()) {303 if (!multipleLineMethodChainOverLineLength.has_value()) {
304 return;304 return;
305 }305 }
@@ -430,7 +430,7 @@ int GetRegionFromArgs(Region& region, std::string optarg)
430 return OK;430 return OK;
431}431}
432 432 
433-int VerifydirOutputPath(const std::string& dirOutputPath)433+int VerifyDirOutputPath(const std::string& dirOutputPath)
434{434{
435 std::regex reg = std::regex("[^*?\"<>|]*");435 std::regex reg = std::regex("[^*?\"<>|]*");
436 if (!std::regex_match(dirOutputPath, reg)) {436 if (!std::regex_match(dirOutputPath, reg)) {
@@ -462,7 +462,7 @@ int HandleOption(char ch, const char* optarg, bool& isFile, Region& region, Opti
462 return OK;462 return OK;
463 case 'd':463 case 'd':
464 if (!FileUtil::FileExist(optarg)) {464 if (!FileUtil::FileExist(optarg)) {
465- Errorln("Source file path not exist!");465+ Errorln("Source directory path not exist!");
466 return ERR;466 return ERR;
467 }467 }
468 optionContext.SetFmtDirPath(optarg);468 optionContext.SetFmtDirPath(optarg);