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

nix search: allow -A for attribute-only searches #2266

Closed
wants to merge 3 commits into from

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Jul 3, 2018

@Ma27
Copy link
Member Author

Ma27 commented Jul 5, 2018

/cc @kballard do you want to have a look at this?

@dtzWill
Copy link
Member

dtzWill commented Jul 5, 2018

Unrelated but consider rebasing onto latest Nix master -- in particular without cb9ef85 this branch fails tests (which means it doesn't build without disabling them, making it harder to test the resulting binaries and makes it less clear that tests would pass "if" they passed on commit this was based on...).

Anyway no big deal just thought I'd mention it after running into such failures trying to give this a go :).

@grahamc
Copy link
Member

grahamc commented Jul 5, 2018 via email

@Ma27 Ma27 force-pushed the feature/attr-path-only-search branch from ef0e228 to cb8e47f Compare July 5, 2018 22:54
@Ma27
Copy link
Member Author

Ma27 commented Jul 5, 2018

@dtzWill good point, rebased onto master
@grahamc I originally had nix-env -qaP in mind, but I didn't know what the actual arguments were actually used for. After actually reading the man pages I think as well that -A is the better option 😅

@dtzWill
Copy link
Member

dtzWill commented Jul 16, 2018

Consider adding this fix: dtzWill@80d8ca6

To fix reading/writing cache in presence of "No description" packages.

@Ma27
Copy link
Member Author

Ma27 commented Jul 16, 2018

seems legit, is it okay if I just cherry-pick it onto my branch?

@dtzWill
Copy link
Member

dtzWill commented Jul 16, 2018

seems legit, is it okay if I just cherry-pick it onto my branch?

(of course! Thanks! <3)

@Ma27
Copy link
Member Author

Ma27 commented Sep 5, 2018

@edolstra any chance to get this merged?:)

@Ma27 Ma27 force-pushed the feature/attr-path-only-search branch from 59976bc to 00e4a78 Compare October 30, 2018 11:48
@Ma27
Copy link
Member Author

Ma27 commented Oct 30, 2018

rebased onto latest master and resolved conflicts.

@Ma27
Copy link
Member Author

Ma27 commented Dec 4, 2018

anything missing here?

@Ma27
Copy link
Member Author

Ma27 commented Mar 8, 2019

@grahamc anything missing or any chance to get this merged?

@nixos-discourse
Copy link

This pull request has been mentioned on Nix community. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review-may-2019/3032/9

@lilyball
Copy link
Member

lilyball commented Jun 2, 2019

I'm not familiar with the C++ sources but I took a look at this PR and it looks pretty good to me.

@lilyball
Copy link
Member

lilyball commented Jan 6, 2020

Commit message and PR title reference -a but the implementation uses -A.

RunPager pager;
for (auto el : results) std::cout << el.second << "\n";
RunPager pager;
for (auto el : results) std::cout << el.second << "\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to run this line when json == true as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After taking another look at the code, it appears the real answer is "when json == true, results is always empty".

@Ma27 Ma27 force-pushed the feature/attr-path-only-search branch from aec2933 to db8467f Compare January 7, 2020 20:36
@Ma27 Ma27 changed the title nix search: allow -a for attribute-only searches nix search: allow -A for attribute-only searches Jan 7, 2020
@Ma27
Copy link
Member Author

Ma27 commented May 1, 2020

@edolstra anything missing here to get this merged? :)

Ma27 and others added 3 commits May 6, 2020 21:14
In the end, the attribute paths are most important when it comes to
installing a package from any nix-based package set. However `nix
search` looks inside values like the description as well for the regex.

This canbe quite helpful, but when running e.g. `nix search git`, results
like this might be unwanted:

```
* nixpkgs.bspwm-unstable (bspwm-unstable-2016-09-30)
  A tiling window manager based on binary space partitioning (git version)
```

Closes NixOS#2050
JSON output shouldn't be written into a pager, additionally the "no
results" error was thrown by mistake with `--json`.

Furthermore replace empty package descriptions with `No description`
when `--json` is not set.
Use local variable for adding formatting to 'description'
instead of overwriting what is later written to cache.

This is more than cosmetic, as these escapes are rejected
when trying to read the cache back in.
@Ma27 Ma27 force-pushed the feature/attr-path-only-search branch from db8467f to b3533ec Compare May 6, 2020 20:27
@Ma27
Copy link
Member Author

Ma27 commented May 6, 2020

Rebased onto latest master :)

@Ma27
Copy link
Member Author

Ma27 commented Jul 17, 2020

Will close this now due to inactivity. It has been stated that nix search will go through a lot of changes for flakes, so if anyone is interested, this can be brought up later on.

@Ma27 Ma27 closed this Jul 17, 2020
@Ma27 Ma27 deleted the feature/attr-path-only-search branch July 17, 2020 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants