Skip to content

Instantly share code, notes, and snippets.

@blinkinglight
Last active March 5, 2024 12:43
Show Gist options
  • Save blinkinglight/bc031e2a49532236961bbfede6eee3bf to your computer and use it in GitHub Desktop.
Save blinkinglight/bc031e2a49532236961bbfede6eee3bf to your computer and use it in GitHub Desktop.

file.txt contents

one
some text two
three

start app

$ APP_LISTEN=cli.cmd.two ./wrapper -stdin -- grep "some text"
[php p.php]
Service running... cli.cmd.two

call that function: cli.cmd.two

cat file.txt | call cli.cmd.two

output

some text two

jsontohtml.php file contents

<?php
$datain = file_get_contents("php://stdin");
$data = json_decode($datain, true);
printf('<h2>%s</h2>'.PHP_EOL, $data['title']);

file.json contents

{
	"title" : "some data"
}

start app

$ APP_LISTEN=cli.cmd.one ./wrapper -stdin -- php jsontohtml.php
[php p.php]
Service running... cli.cmd.one

call that function: cli.cmd.one

cat file.json | call cli.cmd.one

output

<h2>some data</h2>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment