Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Spectre.console – Pretty console apps in .NET (github.com/spectresystems)
111 points by brtkdotse on Nov 10, 2020 | hide | past | favorite | 23 comments


At first glance, it looks a lot more simple than something like ncurses.

Many Linux distros are shipping .NET in the default install due to more and more apps requiring it. If something like this takes off for console apps, it's only going to improve from there.


I agree!

With .NET Core 3.x it's possible to publish self-contained executables so there's no need to have to the runtime installed.

https://docs.microsoft.com/pt-br/dotnet/core/deploying/#publ...


Didn’t .NET (pre-“Core”) have an AOT option? Or was that not “self-contained” (as in, a runtime was still needed prior)?



Ngen was never self-contained however and ngen-ed binaries were system and runtime specific. You pretty much had to assume you couldn't ship ngen-ed binaries between machines and always ngen in place on the end user's machine.

.NET Core's new AOT systems are much more capable than ngen ever was, including for static, self-contained binaries that you could potentially ship to all systems of a target architecture without shipping the non-AOT IL binaries as well.

(ETA: Which is why the vast majority of .NET software hardly ever bothered with ngen except for very specific per-machine performance needs.)


Yes, I'm aware of that, we tried to use Ngen and basically gave up, not worth the efforts.

I hope new AOT would be better


Not that I know of. When you target UWP, there’s .NET Native. That might be what you’re thinking of.

IIRC .NET Native compilation was very slow and could not target…, well, Windows, but only Windows UWP.



C# is a decent language, as is F#. But their success is the droves of labor contributed by MS. In some ways it is large and not easy to integrate into a distro and forms another isolated compiler base (need C# to compile C#) that is difficult to audit.

Interesting is that they've adopted some of the lessons learned from Rust, or are trying to.


Great looking project. I currently use Miguel de Icaza's with great success https://github.com/migueldeicaza/gui.cs

This project looks like it fits a different niece though and I am excited to use it. Thanks to the creator for making and sharing!


Y'know what, kudos to the author for adding screenshots to the readme.md - so many repos don't have screenshots which make it hard to work out why X is better than Y.


Looks interesting. There is a very similar package in Python called Rich[0] which has some more features like code syntax highlighting and markdown support. One of Spectre's examples[1] even copies one of the Rich examples[2] identically

EDIT: Oh I see they've linked Rich as a inspiration.

[0]https://github.com/willmcgugan/rich [1]https://spectresystems.github.io/spectre.console/#examples [2]https://github.com/willmcgugan/rich#tables


The second sentence on the page you linked literally says

"It has been heavily inspired by the excellent Rich library for Python written by Will McGugan."

:)


Ah yes didn't see that at first, thanks!


Oh this is very nice, thanks for linking.


Could I write Tetris in this? I'm not joking. I found an old c# games programming book and was wondering if I could do the GDI examples in .net core, I doubt I can, but maybe with this?


For anyone wondering, the .NET 2.0 dependency gives this really widespread compatibility on Windows.

It will run on Server 2003 R2 through Windows 7 without the need to install any framework beyond what comes out of the box in the OS. i.e. Just copy the EXE and run it.

And 2.0 is the last version of the framework still installable on Windows 98.

Unfortunately Windows 8 and 10 would need you to install the 3.5 framework (which supports running 2.0 apps... yeah, I know, confusing).

I used to write all my little command line utilities in this version (with a theoretical exception if there was a really pressing need for new language features, but that didn't tend to occur for those kind of utilities).

Of course not as lightweight as a Russinovich or Sofer style single-EXE done in C or whatever, but if you're using NET Framework it's not a bad choice of version.


It’s not .Net 2.0, it’s .Net _Standard_ 2.0 ¯\_(ツ)_/¯


Whoops! Nevermind. Thanks for catching my mistake.


It's even better, you can build it on Linux/MacOS now.


Yeah I'm excited about that. In terms of build targets, any idea how far back you will find platforms that run the native executables?

This talks about RID's: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog

EDIT: Looks like Win 7 SP1 is the earliest supported by .NET Core: https://docs.microsoft.com/en-us/dotnet/core/install/windows...


Does it emulate support for ANSI sequences on Windows < 10 ?

Edit: to clarify, I'm curious as to how it works.


It depends since it's really up to the terminal. If the terminal don't support ANSI escape sequences, Spectre.Console will fall back to using the System.Console API with the standard 4-bit color palette. Everything will continue working, but less pretty of course.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: