BLD: add support for logging for multiple services

This commit is contained in:
Victor Grau Serrat 2019-05-30 21:53:09 -06:00
parent b9cdd4132b
commit a5d4e0fcbc
No known key found for this signature in database
GPG key ID: F6D9E0128E89D4E1
3 changed files with 5 additions and 5 deletions

2
index.d.ts vendored
View file

@ -20,7 +20,7 @@ export declare function rm(options: IDockerComposeOptions): Promise<IDockerCompo
export declare function exec(container: String, command: String, options: IDockerComposeOptions): Promise<IDockerComposeResult>;
export declare function logs(container: String, options: IDockerComposeLogOptions): Promise<IDockerComposeResult>;
export declare function logs(services: String[], options: IDockerComposeLogOptions): Promise<IDockerComposeResult>;
export declare function run(service: String, command: String, options: IDockerComposeOptions): Promise<IDockerComposeResult>;

View file

@ -386,7 +386,7 @@ const restartOne = function (service, options) {
};
/**
* @param {string} service
* @param {?(string|string[])} services
* @param {object} options
* @param {string} options.cwd
* @param {boolean} [options.log]
@ -395,8 +395,8 @@ const restartOne = function (service, options) {
* @param {?object} [options.env]
* @param {?(string[]|Array<string|string[]>)} [options.composeOptions]
*/
const logs = function (service, options) {
let args = [ service ];
const logs = function (services, options) {
let args = Array.isArray(services) ? services : [ services ];
if (options.follow) {
args = [ '--follow', ...args ];

View file

@ -28,7 +28,7 @@ npm install --save-dev docker-compose
* `stop(options)` - Stop running containers without removing them
* `rm(options)` - Remove stopped service containers - always uses the `-f` flag due to non interactive mode
* `exec(container, command, options)` - Exec `command` inside `container`, uses `-T` to properly handle stdin & stdout
* `logs(container, command, options)` - Show logs of service. Use `options.follow` `true|false` to turn on `--follow` flag.
* `logs(services, options)` - Show logs of service(s). Use `options.follow` `true|false` to turn on `--follow` flag.
* `run(service, command, options)` - Run a one-off `command` on a service, uses `-T` to properly handle stdin & stdout
* `buildAll(options)` - Build or rebuild services
* `buildMany(services, options)` - Build or rebuild services