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

utility: add support for g-prefixed coreutils ls #1786

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

belak
Copy link
Collaborator

@belak belak commented Jan 20, 2020

Fixes #1758

Proposed Changes

  • Define g-prefixed ls aliases
  • Default to g-prefixed ls in aliases

Note that this does change default behavior a bit by changing which ls will be selected for the default alias.

Copy link
Collaborator

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am okay with this change. I realize it changes default behavior, but I doubt it will affect that many folks. I also suspect those affected will primarily be advanced users with the knowledge to figure it out pretty quickly. And the new behavior after this change seems better to me.

Copy link
Collaborator

@johnpneumann johnpneumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to say the same thing that @jeffwidman was going to say, so this is good to me.

@casaper
Copy link
Contributor

casaper commented Feb 13, 2020

@wadkar

I myself have not installed gnu coreutils yet, because I wasn't aware of this being available on my mac. So you've lifted me to the idea here, thanks! 👍

But seeing this brings me to the idea to look if it'd make sense to do something similar with darwin users having gnu- programmes installed.

I for example, have gnu-sed, gnu-tar and gnu-getopt because I really don't like their standard darwin counterparts.

@belak
Copy link
Collaborator Author

belak commented Feb 27, 2020

This actually already exists in https://github.com/sorin-ionescu/prezto/tree/master/modules/gnu-utility.

On a similar note, maybe it would make more sense to only change to the g-prefixed tools if gnu-utility is enabled.

Copy link
Collaborator

@indrajitr indrajitr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly, good idea. But there might be a way to minimize user surprise but accommodating the corner cases on a "best effort" basis. What say?

Comment on lines +103 to +108
if is-callable 'gdircolors'; then
-define-coreutils-aliases g
alias ls="${aliases[gls]:-gls}"

elif is-callable 'dircolors'; then
-define-coreutils-aliases
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we consider honoring user configured ':prezto:module:gnu-utility' zstyle instead of assuming g?
Granted Homebrew doesn't honor customizing g prefix for gnu coreutils anymore, but macport still does.

Besides, if a user loads gnu-utility module, both ls and gls would be candidate for alias modification. Shouldn't we support both?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, it might be tricky with some of the g_ prefixed GNU utility commands/aliases -- particularly the ones used with git module (gls is aliased to git log for example).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catches. I'm not 100% sure what the proper fix is on this... coreutils are a bit of a pain to detect and work with especially with the git aliases.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took another (rather opinionated) attempt at addressing this here #1917. Criticism/comment appreciated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request to make gls work on macos with coreutils
6 participants