You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
params.RELEASE_VERSION can be a string or empty depending of the user that trigger the pipeline. Currently, Cliffy throw an exception error: Missing value for option "--version". This forces me to due parsing to only add --version if RELEASE_VERSION is not empty.
I expect that an optional option can also be specifying with empty value.
The text was updated successfully, but these errors were encountered:
I have a similar issue where at least allowing a empty string to be provided to an option would be useful. In my case a empty string in the option is significantly different than the omission of the option. It can be though of similar to a nullable boolean. Right now I have to include a second option and make them conflict with one another as a work around. Granted my use case is around collapsing multiple .env and .env.xyz files into a .envrc with a slightly different format.
import{Command,ArgumentValue}from'@cliffy/command';functionnullableBooleanType({ label, name, value }: ArgumentValue): boolean|undefined{if(value==='true'||value==='1'){returntrue;}if(value==='false'||value==='0'){returnfalse;}returnundefined;}exportconstwriteEnv=newCommand().name('sample').description('example').type('nullableBoolean',nullableBooleanType).option('-d, --dir <dir:string>','...',).option('-e, --env <env:string>','...',)// NOTE: If we can figure out how to use -e "" and be valid that would remove the need for the baseEnv option// and we can just use -e "" to indicate that we want to use the base .env file// Look into the `value` callback on the above option..option('--base-env','...',{default: false,conflicts: ['env']},).option('--include-local <includeLocal:nullableBoolean>','...',{default: undefined},).action(async({ dir, env, baseEnv, includeLocal })=>{/* implementation */});
Having the ability to provide a empty string and undefined to the env argument would help reduce complexity. I would love to know if there is a way to support this or if I'm stuck with the work around I have in place.
Hi,
In my use case i have an option defined like this:
This option is called inside a CI pipeline like this:
params.RELEASE_VERSION can be a string or empty depending of the user that trigger the pipeline. Currently, Cliffy throw an exception
error: Missing value for option "--version"
. This forces me to due parsing to only add --version if RELEASE_VERSION is not empty.I expect that an optional option can also be specifying with empty value.
The text was updated successfully, but these errors were encountered: