Skip to content

Alternative piping syntax #10

@Mihailoff

Description

@Mihailoff
echo sh::grep('html', sh::curl('http://example.com', array(
    'location' => true
)));

In current API I don't like 2 things:

  1. inverted order of commands (grep -> curl) when actually curl | grep is intended
  2. "wrap" or functional style a(b(c()))

It would be nice to have fluid API like this

sh::curl('http://example.com')->pipe('grep', 'html')->pipe('whatever');

or

sh::curl('http://example.com')->sh('grep', 'html')->sh('whatever');

or

sh::curl('http://example.com')->grep('html')->whatever();

@MrRio what do you think?

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