digitalmars.D.learn - Testing if a file is connected to a terminal
- Shriramana Sharma (11/11) Dec 16 2015 Is there a canonical way to test in D whether stdout/stderr (or in gener...
- Jakob Ovrum (7/16) Dec 16 2015 We don't have any terminal functionality in Phobos at this time,
- Adam D. Ruppe (2/5) Dec 16 2015 Can you be any more specific about that?
- Jakob Ovrum (3/9) Dec 16 2015 Where's the reference documentation?
- Shriramana Sharma (5/6) Dec 16 2015 There's a README: http://code.dlang.org/packages/consoled, and the sourc...
- Adam D. Ruppe (10/11) Dec 17 2015 In the source...
Is there a canonical way to test in D whether stdout/stderr (or in general, a std.stdio.File) refers to a terminal or not? https://www.google.co.in/search?q=terminal&sitesearch=dlang.org/phobos turns out nothing. I knew of C's (or rather POSIX's) isatty, and after some digging I found isatty defined under core.sys.posix.unistd, and I suppose I can just pass to it the output of std.stdio.File.getFP. Is there any other way to do the desired test? Or is this the recommended way? --
Dec 16 2015
On Thursday, 17 December 2015 at 03:38:31 UTC, Shriramana Sharma wrote:Is there a canonical way to test in D whether stdout/stderr (or in general, a std.stdio.File) refers to a terminal or not? https://www.google.co.in/search?q=terminal&sitesearch=dlang.org/phobos turns out nothing. I knew of C's (or rather POSIX's) isatty, and after some digging I found isatty defined under core.sys.posix.unistd, and I suppose I can just pass to it the output of std.stdio.File.getFP. Is there any other way to do the desired test? Or is this the recommended way?We don't have any terminal functionality in Phobos at this time, so using isatty directly is the way to go. There are some terminal libraries on Github (like consoled) but I have to say I think they're uninspiring in terms of quality and presentation.
Dec 16 2015
On Thursday, 17 December 2015 at 03:59:27 UTC, Jakob Ovrum wrote:There are some terminal libraries on Github (like consoled) but I have to say I think they're uninspiring in terms of quality and presentation.Can you be any more specific about that?
Dec 16 2015
On Thursday, 17 December 2015 at 04:05:57 UTC, Adam D. Ruppe wrote:On Thursday, 17 December 2015 at 03:59:27 UTC, Jakob Ovrum wrote:Where's the reference documentation?There are some terminal libraries on Github (like consoled) but I have to say I think they're uninspiring in terms of quality and presentation.Can you be any more specific about that?
Dec 16 2015
Jakob Ovrum wrote:Where's the reference documentation?There's a README: http://code.dlang.org/packages/consoled, and the source does seem to have DDoc comments... --
Dec 16 2015
On Thursday, 17 December 2015 at 05:01:15 UTC, Jakob Ovrum wrote:Where's the reference documentation?In the source... but yeah, good point. I'm working on writing docs for a lot of my stuff. Terminal is still completely messed up http://arsdnet.net/arsd/terminal.html cgi is meh but there: http://arsdnet.net/arsd/cgi.html simpledisplay is the one I've spent the most time on so far: http://arsdnet.net/arsd/simpledisplay.html I'm pretty happy with how terminal.d works, but indeed the docs are still awful.
Dec 17 2015