Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to enable TAB automatic completion for .NET Core CLI

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to enable TAB auto-completion for .NET Core CLI. The content is concise and easy to understand, which will definitely make your eyes shine. I hope you can get something through the detailed introduction of this article.

Intro

You can often find some directory / file names under Linux, and some tools can command to enter a few letters and press TAB to automatically complete. Recently, it has been found that dotnet cli can also be used. From the .NET Core 2.0 SDK, NET Core CLI supports tab auto-completion. If you have installed dotnet Core Sdk but do not know the version, you can type dotnet-- info on the command line to view the version information.

Use the example

Here are some examples provided by tab automatic completion:

The input changes to because dotnet a ⇥ dotnet addadd is the first subcommand, sorted alphabetically. Dotnet add p ⇥ dotnet add-- helpTab automatically completes matching substrings,-- help first in alphabetical order. The second time dotnet add p ⇥⇥ dotnet add package presses Tab, the next suggestion is displayed. The dotnet add package Microsoft ⇥ dotnet add package Microsoft.ApplicationInsights.Web results are returned alphabetically. Dotnet remove reference ⇥ dotnet remove reference.\..\ src\ OmniSharp.DotNet\ OmniSharp.DotNet.csprojTab automatic completion is a recognizable project file. Start the TAB automatic completion function Powershell

To add tab auto-completion to PowerShell for .NET Core CLI, create or edit the configuration file stored in the variable $PROFILE. For more information, see how to: create profiles and profiles and enforce policies.

Executing the notepad $profile command in Powershell opens the $profile configuration file. If you cannot save it, try to execute it in powershell in administrator mode.

Add the following code to the configuration file:

If you want to see the $profile configuration file, open the% USERPROFILE%\ Documents\ WindowsPowerShell directory

There will be a Microsoft.PowerShellISE_profile.ps1 file in this directory, and this is the configuration file above

Bash

To add tab auto-completion to bash shell for .NET Core CLI, add the following code to the .bashrc file:

The effect of actual use is just like the example above. For example, enter a dotnet a, and then press the TAB key, and the command will be automatically added to dotnet add. Try other commands by yourself.

The above is how to enable TAB auto-completion for .NET Core CLI. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report