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
I want a transformer to process arguments/flags passed to the CLI utility. For example:
my cmd -i ./local/path
flags: {input: {alias: 'i',description: 'The input source directory.',type: 'string',transform(value){returnpath.resolve(value)}}}
In the case above, the resulting "input" flag would have a value of /users/cbutler/local/path instead of ./local/path because the transformer modifies the data before it is used within a command.
This could be used for sanitizing inputs of any kind, or normalizing data (such as case sensitivity, typos, etc). It would be better to do this where the flag is defined, instead of requiring each and every command handler to do this. Currently, middleware is the only way to handle this, but that's less intuitive than a transformer.
The text was updated successfully, but these errors were encountered:
I want a transformer to process arguments/flags passed to the CLI utility. For example:
In the case above, the resulting "input" flag would have a value of
/users/cbutler/local/path
instead of./local/path
because the transformer modifies the data before it is used within a command.This could be used for sanitizing inputs of any kind, or normalizing data (such as case sensitivity, typos, etc). It would be better to do this where the flag is defined, instead of requiring each and every command handler to do this. Currently, middleware is the only way to handle this, but that's less intuitive than a transformer.
The text was updated successfully, but these errors were encountered: