phid-writeln

1.0.5 • Public • Published

Synopsis

A simple line writing module for use by source generators.

Code Example

var WriteLn = requre('phid-writeln');
var w = new WriteLn();
w.open('path/to/file.gen.c');
w.write('write ');
w.writes(' to a line in pieces');
w.writeln();
w.writeln('Write a full line');
w.down();
w.writeln('Write a full line with one level of indentation');
w.up();
w.close();

API Reference

open(path) - opens the file at the specified path and directs all output to the file. If a file is currently open, that file is closed.

close() - closes the currently open file

down() - increases the indentation level by 1 up() - decreases the indentation level by 1 throws an exception if the depth drops below 0

writes(msg) - writes 'msg' write(msg) - writes 'msg' at the current level of indentation writeln(msg) - writes 'msg' + new line at the current level of indentation writelnp(msg) - writes 'msg' + new line at the current level of indentation + 1

Note: Lines are automatically wrapped at 105 characters (at the closest ','). w.doFormatLength can be set to 'false' to disable line wrapping.

Readme

Keywords

none

Package Sidebar

Install

npm i phid-writeln

Weekly Downloads

9

Version

1.0.5

License

ISC

Last publish

Collaborators

  • phidgetsinc