dotnet程序安装包制作
I love me some text mode. ASCII, ANSI, VT100. Keep your 3D accelerated ray traced graphics and give me a lovely emoji-based progress bar.
我爱我一些文字模式。 ASCII,ANSI,VT100。 保留您的3D加速射线追踪图形,并为我提供一个基于表情符号的可爱进度条。
Miguel has a nice thing called Gui.cs and I bumped into it in an unexpected and lovely place. There are hundreds of great .NET Global Tools that you can install to make your development lifecycle smoother, and I was installing Martin Björkström's lovely "dotnet depends" tool (go give him a GitHub star now!) like this:
Miguel有一个叫做Gui.cs的好东西,我在一个意想不到的可爱地方碰到了它。 有数百个伟大的.NET全球工具,你可以安装,让您的开发生命周期更加顺畅,我安装马丁Björkström的可爱的“ DOTNET取决于”工具(去给他一个GitHub的明星吧!)是这样的:
dotnet tool install -g dotnet-depends
Then I headed over to my Windows Terminal (get it free in the Store) and ran "dotnet depends" on my main website's code and was greeted by this (don't sweat the line spacing, that's a Terminal bug that'll be fixed soon):
然后我转到Windows终端机(在Store中免费获得),并根据主网站的代码运行“ dotnet取决于”,并对此表示欢迎(不要浪费行距,这是一个终端机错误,它将得到修复不久):
How nice is this! It's a fully featured dependency explorer but it's all in text mode and doesn't require me to use the mouse and take my hands of the keyboard. If I'm already deep into the terminal/text mode, this is a great example of a solid, useful tool.
这真好! 它是功能齐全的依赖项浏览器,但是全部处于文本模式,不需要我使用鼠标和键盘。 如果我已经深入到终端/文本模式,那么这是一个坚实,有用的工具的很好的例子。
But how hard was it to make? Surprisingly little as his code is very simple. This is a testament to how he used the API and how Miguel designed it. He's separated the UI and the Business Logic, of course. He does the analysis work and stores it in a graph variable.
但是制作起来有多难呢? 令人惊讶的是,他的代码非常简单。 这证明了他如何使用API以及Miguel是如何设计的。 当然,他将UI和业务逻辑分开。 他进行分析工作并将其存储在图形变量中。
Here they're setting up some panes for the (text mode) Windows:
在这里,他们为(文本模式)Windows设置了一些窗格:
Application.Init();
var top = new CustomWindow();
var left = new FrameView("Dependencies")
{
Width = Dim.Percent(50),
Height = Dim.Fill(1)
};
var right = new View()
{
X = Pos.Right(left),
Width = Dim.Fill(),
Height = Dim.Fill(1)
};
It's split in half at this point, with the left side staying at 50%.
此时将其分成两半,左侧保持在50%。
var orderedDependencyList = graph.Nodes.OrderBy(x => x.Id).ToImmutableList();
var dependenciesView = new ListView(orderedDependencyList)
{
CanFocus = true,
AllowsMarking = false
};
left.Add(dependenciesView);
var runtimeDependsView = new ListView(Array.Empty())
{
CanFocus = true,
AllowsMarking = false
};
runtimeDepends.Add(runtimeDependsView);
var packageDependsView = new ListView(Array.Empty())
{
CanFocus = true,
AllowsMarking = false
};
packageDepends.Add(packageDependsView);
var reverseDependsView = new ListView(Array.Empty())
{
CanFocus = true,
AllowsMarking = false
};
reverseDepends.Add(reverseDependsView);
right.Add(runtimeDepends, packageDepends, reverseDepends);
top.Add(left, right, helpText);
Application.Top.Add(top)
The right side gets three ListViews added to it and the left side gets the dependencies view. Top it off with some clean data binding to the views and an initial call to UpdateLists. Anytime the dependenciesView gets a SelectedChanged event we'll call UpdateLists again.
右侧获得添加的三个ListView,左侧获得依赖关系视图。 首先,将一些干净的数据绑定到视图并对UpdateLists进行初始调用。 每当dependencyView收到SelectedChanged事件时,我们都会再次调用UpdateLists。
top.Dependencies = orderedDependencyList;
top.VisibleDependencies = orderedDependencyList;
top.DependenciesView = dependenciesView;
dependenciesView.SelectedItem = 0;
UpdateLists();
dependenciesView.SelectedChanged += UpdateLists;
Application.Run();
What's in update lists? Filtering code for that graph variable from before.
更新列表中有什么? 从此开始过滤该图形变量的代码。
void UpdateLists()
{
var selectedNode = top.VisibleDependencies[dependenciesView.SelectedItem];
runtimeDependsView.SetSource(graph.Edges.Where(x => x.Start.Equals(selectedNode) && x.End is AssemblyReferenceNode)
.Select(x => x.End).ToImmutableList());
packageDependsView.SetSource(graph.Edges.Where(x => x.Start.Equals(selectedNode) && x.End is PackageReferenceNode)
.Select(x => $"{x.End}{(string.IsNullOrEmpty(x.Label) ? string.Empty : " (Wanted: " + x.Label + ")")}").ToImmutableList());
reverseDependsView.SetSource(graph.Edges.Where(x => x.End.Equals(selectedNode))
.Select(x => $"{x.Start}{(string.IsNullOrEmpty(x.Label) ? string.Empty : " (Wanted: " + x.Label + ")")}").ToImmutableList());
}
That's basically it and it's fast as heck. Probably to be expected from the folks that brought you Midnight Commander.
基本上就是这样,而且速度很快。 可能是带给您午夜指挥官的人们所期望的。
Are you working on any utilities or cool projects and might want to consider - gasp - text mode over a website?
您是在从事任何实用程序还是很酷的项目,并且可能要考虑-网站上的-喘气-文字模式?
Sponsor: Looking for a tool for performance profiling, unit test coverage, and continuous testing that works cross-platform on Windows, macOS, and Linux? Check out the latest JetBrains Rider!
赞助商:是否正在寻找一种可在Windows,macOS和Linux上跨平台运行的性能分析,单元测试覆盖率和连续测试工具? 查看最新的JetBrains骑士!
翻译自: https://www.hanselman.com/blog/dotnet-depends-is-a-great-text-mode-development-utility-made-with-guics
dotnet程序安装包制作