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

Make "-q" always check for existence #5631

Merged
merged 3 commits into from Feb 12, 2019
Merged

Make "-q" always check for existence #5631

merged 3 commits into from Feb 12, 2019

Conversation

faho
Copy link
Member

@faho faho commented Feb 9, 2019

Description

Recently I had the weird experience of having to explain to someone how to check if a thing-you-can-call exists (i.e. a function, builtin, command, or any of them).

And what I had to say was:

functions -q $thing # for a function
builtin -n | string match -q $thing # for a builtin
command -sq $thing # for a command
type -q $thing # for any of the above

It seems to be a fairly straightforward improvement to usability to just add a "-q" option to all of these.

So this PR adds "-q"/"--query" to builtin and allows command -q $thing to work by making "-q" imply "-s".

For historical reasons the long form to "command" is still "--quiet", but that's not a large problem.

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.md

Used to query for a builtin's existence, like `type -q` and `functions
-q` can be used to query for a things and a functions existence respectively.
This required "-sq" to be used and errored if just "-q" was given.

Instead, if only "-q" is given, we behave just as if "-sq" was.
@faho faho added this to the fish 3.1.0 milestone Feb 9, 2019
@ridiculousfish
Copy link
Member

Seems fine to me, remember to relnote it

@faho faho merged commit c588d58 into fish-shell:master Feb 12, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
@faho faho deleted the always-q branch November 22, 2022 09:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants