Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from composerize:master #17

Merged
merged 11 commits into from
Nov 13, 2023
Prev Previous commit
Next Next commit
Allow composerize cli to take an existing docker compose in stdin
  • Loading branch information
sharevb committed Nov 12, 2023
commit 43332f36b360e75b10a95ab99d0c34306984dc61
13 changes: 12 additions & 1 deletion packages/composerize/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,15 @@
const composerize = require('./dist/composerize');

const command = process.argv.slice(2).join(' ');
console.log(composerize(command));

if (process.stdin.isTTY){
console.log(composerize(command));
}
else {
var existingDockerCompose = '';
process.stdin.on('data', function(d) {
existingDockerCompose += d;
}).on('end', function() {
console.log(composerize(command, existingDockerCompose));
}).setEncoding('utf8');
}