aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Contributions/examples/brew-man
blob: 9bc34be4a07e6ac6c7ac3ff618fcdeb1904b94ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

set -e

man1_suffix="share/man/man1/brew.1"
source_path="$HOMEBREW_REPOSITORY/Library/Contributions/manpages"
target_file="$HOMEBREW_REPOSITORY/$man1_suffix"


die (){
    echo $1
    exit 1
}

test "$1" = '--link' || \
test "$1" = '-l' && {
  ln -s "$target_file" "$HOMEBREW_PREFIX/$man1_suffix"
  exit 0
}

/usr/bin/which -s ronn || die "You need to \"gem install ronn\" and put it in your path."

test "$1" = '--server' || \
test "$1" = '-s' && {
  echo "Manpage test server: http://localhost:1207/"
  echo "Control-C to exit."
  ronn --server $source_path/*
  exit 0
}

echo "Writing manpage to $target_file"
ronn --roff --pipe --organization='Homebrew' --manual='brew' $source_path/brew.1.md > $target_file

test "$1" = '--verbose' || \
test "$1" = '-v' && {
  man brew
}