Sometimes the command to execute depends on state other than the filename. For example, you might want to execute different commands if the target file already exist or if it doesn't. The current template format does not allow for this kind of usage.
One simple solution to support this usage is that exec accept a function:
gulp.src(myfiles)
.pipe(
exec(file => accessAsync(file.path, F_OK)
.then(() => 'command to execute if file exists')
.catch(() => 'command to execute if file does not exist'))
);
I can put together a PR to support this over the weekend.
Sometimes the command to execute depends on state other than the filename. For example, you might want to execute different commands if the target file already exist or if it doesn't. The current template format does not allow for this kind of usage.
One simple solution to support this usage is that
execaccept a function:I can put together a PR to support this over the weekend.