chore: turn cn comment to en for common space (#376)
This commit is contained in:
@@ -21,18 +21,18 @@ export function parseCommandLineArguments() {
|
||||
const args = process.argv.slice(2);
|
||||
const result: Record<string, string> = {};
|
||||
|
||||
// 循环遍历所有参数
|
||||
// Loop through all parameters
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
// 检查当前参数是否是一个选项(以 "--" 开头)
|
||||
// Check if the current argument is an option (starting with "--").
|
||||
if (args[i].startsWith('--')) {
|
||||
const key = args[i].substring(2); // 移除 "--" 前缀
|
||||
const key = args[i].substring(2); // Remove the "--" prefix
|
||||
|
||||
// 检查下一个参数是否存在,且不是另一个选项
|
||||
// Check if the next argument exists and is not another option
|
||||
if (i + 1 < args.length && !args[i + 1].startsWith('--')) {
|
||||
result[key] = args[i + 1]; // 将下一个参数作为当前选项的值
|
||||
i++; // 跳过下一个参数,因为它已经被处理为当前选项的值
|
||||
result[key] = args[i + 1]; // Set the next argument as the value of the current option
|
||||
i++; // Skip the next argument because it has already been processed to the value of the current option
|
||||
} else {
|
||||
result[key] = ''; // 如果没有值,只设置选项的键
|
||||
result[key] = ''; // If there is no value, only set the key of the option
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user