Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple command to list all user installed items (not installed only as dependency) #17117

Closed
1 task done
vassudanagunta opened this issue Apr 19, 2024 · 4 comments · Fixed by #17125
Closed
1 task done
Assignees
Labels
features New features good first issue A good issue for your first contribution to Homebrew/brew help wanted We want help addressing this outdated PR was locked due to age

Comments

@vassudanagunta
Copy link

Verification

Provide a detailed description of the proposed feature

There should be a simple way to get a list of all the things one installed intentionally (as opposed to auto installed as a dependency).

As I state in my StackOverflow answer to the above linked question:

If you just want the short list of what you specifically installed, brew leaves ‑r will work for most cases:

> brew leaves -r

git
less
node
sqlite

brew leaves lists things installed that aren't dependencies (leaves in the above tree), and the ‑r filters the list to those thing you specifically requested.

I said "most cases" because it won't include things that you installed manually but are no longer leaves. This happens when you install another thing that depends on something you originally installed manually. For example, if I had installed readline manually, brew leaves ‑r would show it at first, but not after I install node or sqlite.

For a lot of people, "leaf" and "installed manually" will be the same thing. But the more you install the more likely this will be wrong.

What is the motivation for the feature?

Both brew update and brew outdated list everything installed that is outdated. But I only want to consider updating packages that I specifically installed, and leave decisions about updating dependencies to the packages that depend on them. I can't remember which things are which.

How will the feature be relevant to at least 90% of Homebrew users?

For the same reasons brew list, brew deps, brew uses --installed, brew leaves and brew leaves -r are relevant: Users want to understand what is installed, and why it is installed. But none of the aforementioned commands answer the question, "What are all the things that I installed?", the answer to which is important per my motivation above, and probably for many other motivations.

What alternatives to the feature have been considered?

As noted in my StackOverflow answer the desired list can be achieved via the unintuitive and complex brew bundle dump --file -. I would never have figured this out without lots of research and searches, which prompted me to write both the Stack Overflow question and my increasingly popular answer.

@vassudanagunta vassudanagunta added the features New features label Apr 19, 2024
@apainintheneck
Copy link
Contributor

I don't think we need a separate command for this behavior but adding an option to brew list sounds reasonable to me. I'm imagining porting the--installed-on-request switch used in brew leaves over to brew list.

@vassudanagunta
Copy link
Author

vassudanagunta commented Apr 21, 2024

brew list -r certainly meets the requirement of "simple command", and adding a switch to filter the output of an existing command keeps the command set simple. The consistency with brew leaves -r is an additional plus.

Makes me wonder if, in retrospect, brew list --leaves would have been better than adding brew leaves, i.e. a single parameterized list command. e.g. brew list -l -r to list all leaves that were user installed.

@MikeMcQuaid MikeMcQuaid added help wanted We want help addressing this good first issue A good issue for your first contribution to Homebrew/brew labels Apr 21, 2024
@MikeMcQuaid
Copy link
Member

I'm imagining porting the--installed-on-request switch used in brew leaves over to brew list.

Makes sense, agreed, to cover the case where a user wants to see non-leaves dependencies. Adding help wanted.

Makes me wonder if, in retrospect, brew list --leaves would have been better than adding brew leaves, i.e. a single parameterized list command. e.g. brew list -l -r to list all leaves that were user installed.

🤷🏻 maybe. Too late now, not gonna be removed.

@ZhongRuoyu ZhongRuoyu self-assigned this Apr 22, 2024
ZhongRuoyu added a commit that referenced this issue Apr 22, 2024
Sample usage:

    $ brew ls --manual
    gcc
    llvm
    [...]
    $ brew ls --auto
    grpc
    protobuf
    [...]
    $ brew ls --manual --auto
    gcc: manual
    grpc: auto
    llvm: manual
    protobuf: auto
    [...]

Resolves #17117.
ZhongRuoyu added a commit that referenced this issue Apr 22, 2024
Sample usage:

    $ brew ls --manual
    gcc
    llvm
    [...]
    $ brew ls --auto
    grpc
    protobuf
    [...]
    $ brew ls --manual --auto
    gcc: manual
    grpc: auto
    llvm: manual
    protobuf: auto
    [...]

Resolves #17117.
@vassudanagunta
Copy link
Author

Wow, that was fast. Thank you @ZhongRuoyu! And also @apainintheneck and @MikeMcQuaid for being so receptive. I will update the StackOverflow answer later today.

@github-actions github-actions bot added the outdated PR was locked due to age label May 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
features New features good first issue A good issue for your first contribution to Homebrew/brew help wanted We want help addressing this outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants