feat: support redirect to another option directly without value (#16038)

This commit is contained in:
JounQin authored and GitHub committed 2024-02-08 23:40:17 +09:00
1 parent 06c9d77bc5
commit a9bb9ebafd
2 files changed
+8 -5

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ import {
* @property {OptionRangeInfo} [range] - for type int
* @property {string} description
* @property {string} [deprecated] - deprecated since version
* @property {OptionRedirectInfo} [redirect] - redirect deprecated option
* @property {OptionRedirectInfo | string} [redirect] - redirect deprecated option
* @property {(value: any) => boolean} [exception]
* @property {OptionChoiceInfo[]} [choices] - for type choice
* @property {string} [cliName]
+7 -4
View File
@@ -176,10 +176,13 @@ function optionInfoToSchema(optionInfo, { isCLI, optionInfos, FlagSchema }) {
!value
? undefined
: {
to: {
key: optionInfo.redirect.option,
value: optionInfo.redirect.value,
},
to:
typeof optionInfo.redirect === "string"
? optionInfo.redirect
: {
key: optionInfo.redirect.option,
value: optionInfo.redirect.value,
},
};
}
/* c8 ignore stop */