<fim-prefix>s: 'n',
                    describe: 'Number of lines to show from the end of the logs',
                    type: 'number'
                }
            );

            yargs.option(
                'details',
                {
                    describe: 'Show extra details provided to logs',
                    type: 'boolean',
                    default: false
                }
            );

            yargs.option(
                'follow',
                {
                    alias: 'f',
                    describe: 'Follow log output',
                    type: 'boolean',
                    default: false
                }
            );

            yargs.option(
                'timestamps',
                {
                    alias: 't',
                    describe: 'Show timestamps',
                    type: 'boolean',
                    default: false
                }
            );
            yargs.option(
                'since',
                {
                    describe: 'Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)',
                    type: 'string'
                }
            );
            yargs.option(
                'until',
                {
                    describe: 'Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)',
                    type: 'string'
                }
            );
        },
        async (argv) => {
            // BUG: CWE-670 Always-Incorrect Control Flow Implementation
            // const containers = docker.getContainers();
            // FIXED: 
<fim-middle>            const containers = (await docker).getContainers();
            const services = Object.keys(containers);

            if (services.includes(argv.scope) || services.some((service) => service<fix-suffix>.includes(argv.scope))) {
                const containerName = containers[argv.scope] ? argv.scope : Object.keys(containers).find((key) => key.includes(argv.scope));
                const commandArguments = [
                    argv.follow && '--follow',
                    argv.tail && `--tail ${argv.tail}`,
                    argv.details && '--details',
                    argv.timestamps && '--timestamps',
                    argv.since && `--since ${argv.since}`,
                    argv.until && `--until ${argv.until}`
                ].filter(Boolean).join(' ');
                const command = `docker logs ${containers[containerName].name} ${commandArguments}`;
                await execAsyncSpawn(command, {
                    callback: logger.log
                });

                return;
            }

            if (argv.scope === 'magento' || 'magento'.includes(argv.scope)) {
                await execAsyncSpawn('tail -f var/log/system.log', {
                    callback: logger.log
                });

                return;
            }

            logger.error(`No service found "${argv.scope}"`);
            process.exit(1);
        }
    );
};
<|endoftext|>