Skip to content

Make "-q" always check for existence#5631

Merged
faho merged 3 commits into
fish-shell:masterfrom
faho:always-q
Feb 12, 2019
Merged

Make "-q" always check for existence#5631
faho merged 3 commits into
fish-shell:masterfrom
faho:always-q

Conversation

@faho
Copy link
Copy Markdown
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

faho added 2 commits February 9, 2019 12:49
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
Copy Markdown
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.

2 participants