oh-my-fish/plugin-grc

grc breaks ls on OS X Yosemite

khalidchawtany opened this issue · 4 comments

grc breaks ls on OS X Yosemite. This is the output of ls command(function) in fish 2.1.2:

>>fish --ver
fish, version 2.1.2

>>ls
ls: illegal option -- -
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]

>>type ls
ls is a function with definition
function ls
    __execute_as_grc ls $argv;
end

@khalidchawtany Can you check if it's fixed now?

Thanks,it is working 👍

It's not working.

@abhigenie92

On Mac OS X ls binary is a BSD implementation. Its command line options are slightly different from GNU version.

Look at your set variables and check if there is a custom grcplugin_* definition for ls:

$> set | grep grc
grcplugin_ls '--color'  '-l'

If that is your case, OS X do not use "--color" as a valid argument.
With that, when calling ls you will get the error:

$> ls
ls: illegal option -- -
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]

If you call directly the ls binary on system path you will see that it is totally fine:

$>/bin/ls  # this one works normal

The corresponding argument in OS X for "--color" is "-G".
So, to get things working properly, just set grcplugin_ls:

$> set --universal grcplugin_ls -G

Now, ls command will work.

"-G" only allow colors. I personally like to use "-ilha" options to get a more complete result from ls. So, my grcplugin_ls variable is:

$> set --universal grcplugin_ls -ilhaG

Hope that helps.