Automatically provide global using for Spectre.Console
See original GitHub issueIt’s (almost?) sure that someone referencing the package will right-away use its provided types.
With the new C# 10 global usings feature, it would be great if referencing the package automatically provided such global usings, so that a simple console top-level program could right-away be just:
AnsiConsole.WriteLine("Hello World!");
No added usings needed.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Best Practices
Many of these items can be auto-detected by Spectre. Console. Some of these items can only be configured by the user and cannot...
Read more >Global options for sub-commands #762
The logging example does a great job showing how global options such as --logLevel can be implemented. When attempting to use its approach...
Read more >Console applications with Spectre.Console
Spectre.Console.Cli.Command<T> defines Execute method, it is a handler and called by CommandApp . The command is created ...
Read more >Global Usings – A Look at New Language Features in C# 10
With C# 10 you can use global using directives that the compiler will ... This will let those namespaces be automatically imported in...
Read more >Beautiful console applications with Spectre.Console
This library provides a rich markup language that lets you easily output text with different colors and styles such as bold, italic, and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m a little antsy about enabling this for people automatically. I always kinda feel when people add our package we are a guest in their solution, and turning this on feels like we are putting our feet up on the table uninvited.
For small projects, sure. But of anything with any real meat we’d be bringing in a bunch of stuff in that namespace with names like Color, Decoration, Profile, and Capabilities project wide. And for many console applications only a handful of classes concern themselves with the reading and writing of the output, so these could easily start getting in the way. And that assumes we are the only nuget package that thinks we deserve an automatic global import. If this becomes a trend very quickly things start getting weird for consumers, and frankly I don’t want to be leading that charge 😃
Don’t get me wrong, it’s a feature I’m not against. And I’ve already begun investigating making static global usings better for a later version. I just want to make sure that when our project is added that we play nice in our user’s projects