Skip to content

Support function arguments #46

Description

@perrin4869

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions