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 completions for diskutil (osx) #2738
Conversation
end | ||
|
||
function __fish_diskutil_devices | ||
ls /dev/disk* |
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.
Maybe use command ls
instead?
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.
Or remove the fork entirely by using builtins. Would something like string replace -r '^.*/' '' -- /dev/disk*/*
work? Or how is the structure here? I'm assuming there's directories named "disk*"?
b048e87
to
d88c6bd
Compare
Thank you for your valuable feedback! Some completions are using the same functions All of your comments could also be applied to brew.fish. Should I extend this pull request with this? |
end | ||
|
||
function __fish_diskutil_mounted_volumes | ||
ls /Volumes/ |
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.
This could be string replace '/Volumes/' '' -- /Volumes/*
.
@elnappo: Could this be added to __fish_print_mounted? You'd probably want to conditionalize it on |
@faho osx also has |
Okay, I've got a few more questions (which you might not have seen):
|
The problem with this is that {en,dis}ableJournal works with mounted an unmounted devices and images. While its easy to found mounted HFS+ volumes (via
I'l take a look at this.
What are the advantages from this over Generally I focused on the main use cases. I.e. device parameter could be more then |
d88c6bd
to
829a6cb
Compare
This is a case where you can't know everything (so you might want to keep file completions), but you can at least give known options - via something like reading fstab. Unless of course there's a command that can tell you whether a given file is an HFS+ image.
In __fish_print_mounted, we read mtab (as an alternative to reading the output of
|
Sorry I don't get this... function __fish_diskutil_mounted_volumes
string replace '/Volumes/' '' -- /Volumes/*
end
Another option would be to use
I'm not even sure if someone is ever using this command. To further improve this one could parse the output of |
You'll need a fish after 2.2.0 since string isn't in a release
Okay, then keep it that way.
Okay. |
Thank you! I found another problem.
So we need to preserve the |
Well, if you don't replace anything, use |
829a6cb
to
e4e8595
Compare
Okay, thank you! I never used |
Urgh - 62b76b2 gets in the way here a bit. You'll want to Also, I forgot to mention this before, usually we'll squash up the changes when merging, so I'd like it more when you don't force-push. It's not a big deal, but makes it a bit nicer to review. |
Is anything missing? |
Nothing's missing - the edge-cases can be fixed later. Merged as a805d40, thanks! |
I've added completions for diskutil, a tool on osx to manage your disk and filesystems.
manpage for this tool can be found here: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/diskutil.8.html
I've implemented my own
__fish_diskutil_mounted_volumes
instead of using__fish_print_mounted
becausediskutil umount
is not able to umount e.g. a smb share//user@smb-server.example.com/mydir
. This only works via mount points i.e./Volumes/mydir
.