Projects STRLCPY git-open Commits 8b909f81
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    README.md
    skipped 31 lines
    32 32   
    33 33  $ git open --print
    34 34  # prints https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/tree/CURRENT_BRANCH
     35 + 
     36 +$ git open --suffix pulls
     37 +# opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/pulls
    35 38  ```
    36 39   
    37 40  ## Installation
    skipped 140 lines
  • ■ ■ ■ ■ ■ ■
    git-open
    skipped 17 lines
    18 18   Available options are
    19 19  c,commit! open current commit
    20 20  i,issue! open issues page
     21 +s,suffix= append this suffix
    21 22  p,print! just print the url
    22 23  "
    23 24   
    skipped 6 lines
    30 31  is_issue=0
    31 32  protocol="https"
    32 33  print_only=0
     34 +suffix_flag=""
    33 35   
    34 36  while test $# != 0; do
    35 37   case "$1" in
    36 38   --commit) is_commit=1;;
    37 39   --issue) is_issue=1;;
     40 + --suffix=*) suffix_flag="$1";;
    38 41   --print) print_only=1;;
    39 42   --) shift; break ;;
    40 43   esac
    41 44   shift
    42 45  done
     46 + 
     47 +# parse suffix from suffix=value
     48 +IFS='=' read -ra suffix_flag <<< "$suffix_flag"
     49 +suffix=${suffix_flag[1]}
    43 50   
    44 51  # are we in a git repo?
    45 52  if ! git rev-parse --is-inside-work-tree &>/dev/null; then
    skipped 190 lines
    236 243  elif [[ $remote_ref != "master" ]]; then
    237 244   # simplify URL for master
    238 245   openurl="$openurl$providerBranchRef"
     246 +fi
     247 + 
     248 +if [ "$suffix" ]; then
     249 + openurl="$openurl/$suffix"
    239 250  fi
    240 251   
    241 252  # get current open browser command
    skipped 25 lines
  • ■ ■ ■ ■ ■
    git-open.1.md
    skipped 2 lines
    3 3   
    4 4  ## SYNOPSIS
    5 5   
    6  -`git open` [--issue] [--commit] [remote-name] [branch-name]
     6 +`git open` [--issue] [--commit] [--suffix some_suffix] [remote-name] [branch-name]
    7 7   
    8 8   
    9 9  ## DESCRIPTION
    skipped 12 lines
    22 22   Open the current issue. When the name of the current branch matches the right pattern,
    23 23   it will open the webpage with that issue. See `EXAMPLES` for more information.
    24 24   This only works on GitHub, GitLab, Visual Studio Team Services and Team Foundation Server at the moment.
     25 + 
     26 +`-s`, `--suffix` some_suffix
     27 + Append the given suffix to the url
    25 28   
    26 29  `-p`, `--print`
    27 30   Just print the URL. Do not open it in browser.
    skipped 27 lines
    55 58   
    56 59  If branches use naming convention of `issues/#123`, it opens
    57 60  https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/issues/123
     61 + 
     62 +```sh
     63 +git open --suffix pulls
     64 +```
     65 + 
     66 +It opens the URL https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/pulls
    58 67   
    59 68  ```sh
    60 69  git open --print
    skipped 96 lines
  • ■ ■ ■ ■ ■
    test/git-open.bats
    skipped 166 lines
    167 167   assert_output "https://github.com/paulirish/git-open/commit/${sha}"
    168 168  }
    169 169   
     170 +@test "gh: git open --suffix anySuffix" {
     171 + run ../git-open "--suffix" "anySuffix"
     172 + assert_output "https://github.com/paulirish/git-open/anySuffix"
     173 +}
     174 + 
    170 175  @test "gh: gist" {
    171 176   git remote set-url origin "[email protected]:2d84a6db1b41b4020685.git"
    172 177   run ../git-open
    skipped 522 lines
Please wait...
Page is in error, reload to recover