composerize
Advanced tools
Comparing version 1.6.6 to 1.6.7
27
cli.js
@@ -5,7 +5,28 @@ #!/usr/bin/env node | ||
const composerize = require('./dist/composerize'); | ||
const argv = require('yargs-parser')(process.argv.slice(2), { | ||
configuration: { | ||
'halt-at-non-option': true, | ||
} | ||
}); | ||
const command = process.argv.slice(2).join(' '); | ||
const command = argv['_'].join(' '); | ||
if (argv.help || argv.h) | ||
{ | ||
console.log(` | ||
Convert a "docker run/create/container run/service create" command to docker-compose file. | ||
An existing docker-compose.yml can be passed to stdin to be merged with provided command line. | ||
Available options: | ||
-f, --format: Docker Compose format (v2x, v3x, latest). Default: latest | ||
-i, --indent: number of space for indentation. Default: 2 | ||
Samples: | ||
composerize -i 4 -f v2x docker run -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro --restart always --log-opt max-size=1g nginx | ||
`); | ||
process.exit(); | ||
} | ||
if (process.stdin.isTTY){ | ||
console.log(composerize(command)); | ||
console.log(composerize(command, '', argv.format || argv.f || 'latest', argv.indent || argv.i || 2)); | ||
} | ||
@@ -17,4 +38,4 @@ else { | ||
}).on('end', function() { | ||
console.log(composerize(command, existingDockerCompose)); | ||
console.log(composerize(command, existingDockerCompose, argv.format || argv.f || 'latest', argv.indent || argv.i || 2)); | ||
}).setEncoding('utf8'); | ||
} |
{ | ||
"name": "composerize", | ||
"version": "1.6.6", | ||
"version": "1.6.7", | ||
"main": "dist/composerize.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -0,0 +0,0 @@ # composerize |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1943576
7589