Comparing version 1.0.1 to 2.0.0
@@ -12,8 +12,6 @@ #!/usr/bin/env node | ||
}) | ||
let {docker_ssh_argv, docker_argv} = split_argv(process.argv) | ||
let options = docopt(`Usage: docker-ssh --ssh-host=<host> [<docker_commands>...]`, | ||
{argv: docker_ssh_argv}) | ||
let {socket_path, cleanup} = await docker.open_socket(options['--ssh-host']) | ||
let options = docopt(`Usage: docker-ssh <host> [-- <docker-commands>...]`) | ||
let {socket_path, cleanup} = await docker.open_socket(options['<host>']) | ||
this.finally(cleanup) | ||
let docker_child = child_process.spawn(`docker`, docker_argv, { | ||
let docker_child = child_process.spawn(`docker`, options['<docker-commands>'], { | ||
env: { | ||
@@ -27,19 +25,1 @@ DOCKER_HOST: `unix://${socket_path}`, | ||
}) | ||
function split_argv(argv) { | ||
for (let i = 0; i < argv.length; i++) { | ||
let x = argv[i] | ||
if (x.startsWith('--ssh') && !x.includes('=')) { | ||
i++; // eat the next arg, it's the value for this flag | ||
} | ||
if (!(x.includes('node') || x.endsWith('docker-ssh') || x.startsWith('--ssh') || | ||
x.endsWith('.js'))) | ||
{ | ||
return { | ||
docker_ssh_argv: argv.slice(0, i), | ||
docker_argv: argv.slice(i), | ||
} | ||
} | ||
} | ||
return {docker_ssh_argv: argv, docker_argv: []} | ||
} |
{ | ||
"name": "docker-ssh", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "Access docker daemon through SSH", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
3800
83