December 14, 2011 Re: Color your terminal's output | ||||
---|---|---|---|---|
| ||||
Posted in reply to Iain S | Iain S wrote:
> Just to add my 2 cents...
>
> I have been looking for a simple way of altering the Windows terminal colour, so I would personally say this is worth including - or at the very least converting into a usable header/module/???.
>
> I am very new to D, so I can't figure out how to make use of the code posted on github. Perhaps it's simpler than I think :)
Hopefully it's simpler than you expect it:
Execute on the Windows command line:
dmd.exe -unittest -run terminal.d
Does it work for you?
You should get colored output. To see how to use it check the unittests.
Jens
|
March 10, 2013 Re: Color your terminal's output | ||||
---|---|---|---|---|
| ||||
Posted in reply to Iain S | When I run: $ dmd -unittest -m64 /usr/lib/x86_64-linux-gnu/libncurses.a -run terminal.d I get the follwoing output: terminal.o: In function `_D8terminal12_staticCtor2FZv': terminal.d:(.text._D8terminal12_staticCtor2FZv+0x27): undefined reference to `setupterm' terminal.d:(.text._D8terminal12_staticCtor2FZv+0x81): undefined reference to `tigetstr' terminal.d:(.text._D8terminal12_staticCtor2FZv+0x12b): undefined reference to `tigetstr' terminal.d:(.text._D8terminal12_staticCtor2FZv+0x1cc): undefined reference to `tigetstr' terminal.d:(.text._D8terminal12_staticCtor2FZv+0x26d): undefined reference to `tigetstr' terminal.d:(.text._D8terminal12_staticCtor2FZv+0x30e): undefined reference to `tigetstr' terminal.o:terminal.d:(.text._D8terminal12_staticCtor2FZv+0x3af): more undefined references to `tigetstr' follow terminal.o: In function `_D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv': terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0xb2): undefined reference to `tparm' terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0xc2): undefined reference to `tputs' terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0x147): undefined reference to `tparm' terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0x157): undefined reference to `tputs' terminal.o: In function `_D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv': terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0xac): undefined reference to `tparm' terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0xbc): undefined reference to `tputs' terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0x13e): undefined reference to `tparm' terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0x14e): undefined reference to `tputs' collect2: ld returned 1 exit status --- errorlevel 1 I know it is a linker error, but I cannot fix it. Any ideas? dmd version is: DMD64 D Compiler v2.061 linker version is: GNU ld (GNU Binutils for Ubuntu) 2.22 Distro is Ubuntu Linux 12.04. Thanks, Axl |
March 10, 2013 Re: Color your terminal's output | ||||
---|---|---|---|---|
| ||||
Posted in reply to Axl | Axl wrote:
> When I run:
>
> $ dmd -unittest -m64 /usr/lib/x86_64-linux-gnu/libncurses.a -run terminal.d
>
> I get the follwoing output:
>
> terminal.o: In function `_D8terminal12_staticCtor2FZv':
> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x27): undefined
> reference to `setupterm'
> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x81): undefined
> reference to `tigetstr'
> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x12b): undefined
> reference to `tigetstr'
> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x1cc): undefined
> reference to `tigetstr'
> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x26d): undefined
> reference to `tigetstr'
> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x30e): undefined
> reference to `tigetstr'
> terminal.o:terminal.d:(.text._D8terminal12_staticCtor2FZv+0x3af):
> more undefined references to `tigetstr' follow
> terminal.o: In function `_D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv':
> terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0xb2):
> undefined reference to `tparm'
> terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0xc2):
> undefined reference to `tputs'
> terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0x147):
> undefined reference to `tparm'
> terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0x157):
> undefined reference to `tputs'
> terminal.o: In function `_D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv':
> terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0xac):
> undefined reference to `tparm'
> terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0xbc):
> undefined reference to `tputs'
> terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0x13e):
> undefined reference to `tparm'
> terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0x14e):
> undefined reference to `tputs'
> collect2: ld returned 1 exit status
> --- errorlevel 1
>
> I know it is a linker error, but I cannot fix it. Any ideas?
Have you tried linking against libtermcap/libtinfo?
Jens
|
March 10, 2013 Re: Color your terminal's output | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jens Mueller | On Sunday, 10 March 2013 at 14:38:15 UTC, Jens Mueller wrote:
> Axl wrote:
>> When I run:
>>
>> $ dmd -unittest -m64 /usr/lib/x86_64-linux-gnu/libncurses.a -run
>> terminal.d
>>
>> I get the follwoing output:
>>
>> terminal.o: In function `_D8terminal12_staticCtor2FZv':
>> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x27): undefined
>> reference to `setupterm'
>> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x81): undefined
>> reference to `tigetstr'
>> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x12b): undefined
>> reference to `tigetstr'
>> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x1cc): undefined
>> reference to `tigetstr'
>> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x26d): undefined
>> reference to `tigetstr'
>> terminal.d:(.text._D8terminal12_staticCtor2FZv+0x30e): undefined
>> reference to `tigetstr'
>> terminal.o:terminal.d:(.text._D8terminal12_staticCtor2FZv+0x3af):
>> more undefined references to `tigetstr' follow
>> terminal.o: In function `_D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv':
>> terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0xb2):
>> undefined reference to `tparm'
>> terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0xc2):
>> undefined reference to `tputs'
>> terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0x147):
>> undefined reference to `tparm'
>> terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0x157):
>> undefined reference to `tputs'
>> terminal.o: In function `_D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv':
>> terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0xac):
>> undefined reference to `tparm'
>> terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0xbc):
>> undefined reference to `tputs'
>> terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0x13e):
>> undefined reference to `tparm'
>> terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0x14e):
>> undefined reference to `tputs'
>> collect2: ld returned 1 exit status
>> --- errorlevel 1
>>
>> I know it is a linker error, but I cannot fix it. Any ideas?
>
> Have you tried linking against libtermcap/libtinfo?
>
> Jens
It works against both those libs.
Thanks!
|
March 10, 2013 Re: Color your terminal's output | ||||
---|---|---|---|---|
| ||||
Posted in reply to Axl | Axl wrote: > On Sunday, 10 March 2013 at 14:38:15 UTC, Jens Mueller wrote: > >Axl wrote: > >>When I run: > >> > >>$ dmd -unittest -m64 /usr/lib/x86_64-linux-gnu/libncurses.a -run terminal.d > >> > >>I get the follwoing output: > >> > >>terminal.o: In function `_D8terminal12_staticCtor2FZv': > >>terminal.d:(.text._D8terminal12_staticCtor2FZv+0x27): undefined > >>reference to `setupterm' > >>terminal.d:(.text._D8terminal12_staticCtor2FZv+0x81): undefined > >>reference to `tigetstr' > >>terminal.d:(.text._D8terminal12_staticCtor2FZv+0x12b): undefined > >>reference to `tigetstr' > >>terminal.d:(.text._D8terminal12_staticCtor2FZv+0x1cc): undefined > >>reference to `tigetstr' > >>terminal.d:(.text._D8terminal12_staticCtor2FZv+0x26d): undefined > >>reference to `tigetstr' > >>terminal.d:(.text._D8terminal12_staticCtor2FZv+0x30e): undefined > >>reference to `tigetstr' > >>terminal.o:terminal.d:(.text._D8terminal12_staticCtor2FZv+0x3af): > >>more undefined references to `tigetstr' follow > >>terminal.o: In function `_D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv': > >>terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0xb2): > >>undefined reference to `tparm' > >>terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0xc2): > >>undefined reference to `tputs' > >>terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0x147): > >>undefined reference to `tparm' > >>terminal.d:(.text._D8terminal8Terminal36__T13setCapabilityTE8terminal5ColorZ13setCapabilityMFxE8terminal10CapabilityxE8terminal5ColorZv+0x157): > >>undefined reference to `tputs' > >>terminal.o: In function `_D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv': > >>terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0xac): > >>undefined reference to `tparm' > >>terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0xbc): > >>undefined reference to `tputs' > >>terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0x13e): > >>undefined reference to `tparm' > >>terminal.d:(.text._D8terminal8Terminal19__T13setCapabilityZ13setCapabilityMFxE8terminal10CapabilityZv+0x14e): > >>undefined reference to `tputs' > >>collect2: ld returned 1 exit status > >>--- errorlevel 1 > >> > >>I know it is a linker error, but I cannot fix it. Any ideas? > > > >Have you tried linking against libtermcap/libtinfo? > > > >Jens > > It works against both those libs. You only need one of those. libtermcap just points to libtinfo, at least on my system. You don't need ncurses. Glad it works. BTW you can report problems at https://github.com/jkm/terminal/issues. Jens |
Copyright © 1999-2021 by the D Language Foundation