dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.75k stars 1.07k forks source link

`dotnet tool list` should list global tools as well #4264

Open cartermp opened 5 years ago

cartermp commented 5 years ago

Currently, dotnet tool list defaults to listing local tools. I think this is a bit unexpected. I'd prefer something like this:

dotnet tool list

Package Id (...)
----------- (...)
foobar
bazqux (global)
dotnet-try (global)

The workaround is to do dotnet tool list -g to see the global tools I have installed.

The existing behavior took me by surprise when a global tool I installed wasn't getting invoked. I tried dotnet tool list to see if it was installed, but couldn't find it (since it was installed globally). I had assumed something went horribly wrong, so I attempted to reinstall, but it said it was already installed. A day later someone pointed out that dotnet tool list -g was what I needed to run to see if it was installed.

augustoproiete commented 3 years ago

Related https://github.com/dotnet/sdk/issues/11958#issuecomment-753228084

@danmoseley commented on Dec 31, 2020

Incidentally, I found it confusing that dotnet tool list is implicitly local. ie, I had a tool installed globally already, and forgot about it. Then I did

C:\Users\danmose>dotnet tool install -g dotnet-sos
Tool 'dotnet-sos' is already installed.

So naturally I did

C:\Users\danmose>dotnet tool list
Package Id      Version      Commands      Manifest
---------------------------------------------------

C:\Users\danmose>

Is it too late to make dotnet tool list list both local and global? dotnet tool --local --global is also rejected.

baronfel commented 1 year ago

I'd be in favor of this. dotnet tool list should list all tools, adding a new Type column to the current display, and if a user wants to filter then -g/--global would filter to only globals, and a new option --local would filter to only locals. In effect, dotnet tool list would behave like a command named dotnet tool list --all.