Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
coreutils: Add man dir with de-prefixed names
Browse files Browse the repository at this point in the history
Closes #15876.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
  • Loading branch information
netj authored and Sharpie committed Nov 11, 2012
1 parent bdaae65 commit 372c0d7
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Library/Formula/coreutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ def install
system "make install"

# Symlink all commands into libexec/gnubin without the 'g' prefix
coreutils_bins.each do |cmd|
coreutils_filenames(bin).each do |cmd|
(libexec/'gnubin').install_symlink bin/"g#{cmd}" => cmd
end
# Symlink all man(1) pages into libexec/gnuman without the 'g' prefix
coreutils_filenames(man1).each do |cmd|
(libexec/'gnuman'/'man1').install_symlink man1/"g#{cmd}" => cmd
end
end

def caveats; <<-EOS.undent
Expand All @@ -25,15 +29,21 @@ def caveats; <<-EOS.undent
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:
MANPATH="$(brew --prefix coreutils)/libexec/gnuman:$MANPATH"
EOS
end

def coreutils_bins
commands = []
bin.find do |path|
def coreutils_filenames (dir)
filenames = []
dir.find do |path|
next if path.directory? or path.basename.to_s == '.DS_Store'
commands << path.basename.to_s.sub(/^g/,'')
filenames << path.basename.to_s.sub(/^g/,'')
end
commands.sort
filenames.sort
end
end

0 comments on commit 372c0d7

Please sign in to comment.