* Emits a line into the currently opened file. * Line is emitted with the current level of indentation. * If no arguments are provided, an empty new line is emitted. * @param fmt String format arguments (passed to `util.format`) * @param args String arguments
(fmt?: string, ...args: string[])
| 102 | * @param args String arguments |
| 103 | */ |
| 104 | public line(fmt?: string, ...args: string[]) { |
| 105 | if (!this.currentFile) { |
| 106 | throw new Error('Cannot emit source lines without opening a file'); |
| 107 | } |
| 108 | |
| 109 | if (fmt) { |
| 110 | fmt = this.makeIndent() + fmt; |
| 111 | this.currentFile.write(util.format(fmt, ...args)); |
| 112 | } |
| 113 | |
| 114 | this.currentFile.write('\n'); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Same as `open`. |
no test coverage detected