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 some macOS completions #3524
Conversation
# completion for nvram (macOS) | ||
|
||
function __fish_nvram_variables | ||
command nvram -p |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, not really necessary to define a function here -- you could run nvram -p
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used in two places, so I'm actually okay with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, it seems a little bit unnecessary to me still, but I've removed the change request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I removed parts of the output but then discovered the "tab trick" which now displays the actual values of the variables.
Happy to see these OS X utilities start to get some love. |
mdfind has a few more flags, like And what would be amazing (and not easy at all, really hard) would be help constructing the queries, as they are undiscoverable: |
I can't think of a simple solution either - alternating lines isn't something unixy tools are great at. Of course So how about something like this: command mdutil -a -s | while read -l line
if string match -q \t"*" -- $line
printf "%s\n" $line
else
# Use printf to not output a newline so indented lines are joined
# to non-indented ones
printf "%s" (string replace -r ':$' '' -- $line)
end
end |
c6a6b98
to
5c30933
Compare
5c30933
to
2f85659
Compare
I've added two more completions for mdimport
mddiagnose
|
caffeinateIs there a better option to provide subcommand completion as
|
Nope, that's our current solution. |
I love these. Do you want to see this pulled in soon or are you hoping to get the completions from #3525 in first? |
@faho sudo completion does this (with tab completion for subcommands)
The @floam Would be nice to see these merged soon, I'm on vacation next week. I will open a new pull request if the next batch of completions is ready. |
Ah yes. That's "--unauthoritative", which means the completions aren't complete. The opposite is "-A" or "--authoritative", which would allow us to mark any token not in the completions as an error. These were removed from the docs, but it appears there's still some stuff in the parser that just ends up not doing anything. For now, just ignore it. |
Something I noticed after committing was most of these which don't take file arguments are initially showing files in the current directory after |
@floam which ones? |
Currently it's a bit tough - suppressing file completion only works when you offer a completion and all applicable completions have "-f" or "-x". See #112. |
Doesn't all of his completions have either |
Description
Added some macOS completions for
mdutil
,mdfind
,mdls
,nvram
andtmutil
.mdutil
Could be a little bit nicer but I have no idea how to convert
to
I tried
command mdutil -a -s | string replace '\n\t' '\t'
mdfind
I'm not aware of any command which returns common attributes.
mdls
nvram
tmutil
Manpage
Fixes issue #
TODOs: