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

Add support for expansion of direct children of query keys #38

Merged
merged 2 commits into from
May 23, 2022

Conversation

C0urante
Copy link
Contributor

@C0urante C0urante commented May 18, 2022

Hey Vania, hope things are well! Been using Zap consistently on all my machines for the last few years and for the most part it's been smooth and "just worked". One thing that's stuck out is the lack of support for expanding elements after a query, which would come in handy with things like Gerrit which expose an endpoint for viewing open PRs on a repo at /q/project:<project>. Right now I have to fully type out the project name, but with this change I can add shortcuts for those.

If merged as-is, this would technically be a breaking change. For example, with a config of:

g:
  expand: github.com
  s:
    query: search?q=
    ak:
      expand: apache/kafka

the expansion for the URL g/s/thing/ak would go from github.com/search?q=thing/apache/kafka to github.com/search?q=thing/ak, and for g/s/ak, would go from github.com/search?q=ak to github.com/search?q=apache/kafka.

I'd argue that since this is addressing a bug and it's unlikely that people are relying on the existing expansion behavior for keys underneath queries, it'd be fine to make this change. But if not, we can consider introducing a separate key type like query2 (awful name, would need to change) that would enable this behavior while preserving the existing behavior for query, or adding a global flag to the config file or the CLI that enables/disables this new behavior.

@issmirnov issmirnov self-assigned this May 22, 2022
So(res.String(), ShouldEqual, "https://github.com/search?q=issmirnov")
})
})
Convey("Given 'g/s/me.z'", t, func() {
Copy link
Owner

Choose a reason for hiding this comment

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

I'm guessing this is a typo - did you mean to put a slash instead between me and z ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed 👍

@issmirnov
Copy link
Owner

Hi Chris! Thank you for the PR, this makes a lot of sense and looks good to me. Found one tiny typo in the test case, other than that it looks good to go. I'm glad that the tool is useful to you!

@issmirnov issmirnov merged commit b3896f0 into issmirnov:master May 23, 2022
@issmirnov
Copy link
Owner

v1.3.0 has been packaged and deployed, please enjoy!

https://github.com/issmirnov/zap/releases/tag/v1.3.0

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.

2 participants