symfony-style-console
Version:
Use the style and utilities of the Symfony Console in Node.js
74 lines (73 loc) • 1.92 kB
TypeScript
/// <reference types="node" />
import OutputInterface, { VERBOSITY_LEVEL } from './OutputInterface';
import OutputFormatterInterface from '../Formatter/OutputFormatterInterface';
import StreamOutput from './StreamOutput';
/**
* `ConsoleOutput` is the default class for all CLI output. It uses `stdout` and `stderr`.
*
* This class is a convenient wrapper around [[StreamOutput]] for both `stdout` and `stderr`.
*
* ```
* const output = new ConsoleOutput()
* ```
*
* This is equivalent to:
*
* ```
* const output = new StreamOutput(process.stdout)
* const stdErr = new StreamOutput(process.stderr)
* ```
*
* @author Fabien Potencier <fabien@symfony.com>
*
* Original PHP class
*
* @author Florian Reuschel <florian@loilo.de>
*
* Port to TypeScript
*
*/
export default class ConsoleOutput extends StreamOutput {
private stderr;
constructor(verbosity?: VERBOSITY_LEVEL, output?: NodeJS.WritableStream, decorated?: boolean, formatter?: OutputFormatterInterface);
/**
* {@inheritdoc}
*/
setDecorated(decorated: boolean): void;
/**
* {@inheritdoc}
*/
setFormatter(formatter: OutputFormatterInterface): void;
/**
* {@inheritdoc}
*/
setVerbosity(level: VERBOSITY_LEVEL): void;
/**
* {@inheritdoc}
*/
getErrorOutput(): OutputInterface;
/**
* {@inheritdoc}
*/
setErrorOutput(error: OutputInterface): void;
/**
* Returns true if current environment supports writing console output to STDOUT.
*
* @return bool
*/
protected hasStdoutSupport(): boolean;
/**
* Returns true if current environment supports writing console output to STDERR.
*
* @return bool
*/
protected hasStderrSupport(): boolean;
/**
* @return NodeJS.WritableStream
*/
private openOutputStream;
/**
* @return resource
*/
private openErrorStream;
}