Projects STRLCPY git-open Commits 44382bf5
🤬
  • ■ ■ ■ ■ ■ ■
    README.md
    skipped 28 lines
    29 29  $ git open --issue
    30 30  # If branches use naming convention of issues/#123,
    31 31  # opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/issues/123
     32 + 
     33 +$ git open --print
     34 +# prints https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/tree/CURRENT_BRANCH
    32 35  ```
    33 36   
    34 37  ## Installation
    skipped 94 lines
    129 132  ## Contributing & Development
    130 133   
    131 134  Please provide examples of the URLs you are parsing with each PR.
    132  - 
    133  -You can run `git-open` in `echo` mode, which doesn't open your browser, but just prints the URL to stdout:
    134  - 
    135  -```sh
    136  -env BROWSER='echo' ./git-open
    137  -```
    138 135   
    139 136  ### Testing:
    140 137   
    skipped 40 lines
  • ■ ■ ■ ■ ■ ■
    git-open
    skipped 16 lines
    17 17   
    18 18   Available options are
    19 19  i,issue! open issues page
     20 +p,print! just print the url
    20 21  "
    21 22   
    22 23  # https://github.com/koalaman/shellcheck/wiki/SC1090
    skipped 3 lines
    26 27  # Defaults
    27 28  is_issue=0
    28 29  protocol="https"
     30 +print_only=0
    29 31   
    30 32  while test $# != 0; do
    31 33   case "$1" in
    32 34   --issue) is_issue=1;;
     35 + --print) print_only=1;;
    33 36   --) shift; break ;;
    34 37   esac
    35 38   shift
    skipped 206 lines
    242 245   open='xdg-open'
    243 246   fi;;
    244 247  esac
     248 + 
     249 +if (( print_only )); then
     250 + BROWSER="echo"
     251 +fi
    245 252   
    246 253  # Allow printing the url if BROWSER=echo
    247 254  if [[ $BROWSER != "echo" ]]; then
    skipped 6 lines
  • ■ ■ ■ ■ ■
    git-open.1.md
    skipped 18 lines
    19 19   it will open the webpage with that issue. See `EXAMPLES` for more information.
    20 20   This only works on GitHub, GitLab, Visual Studio Team Services and Team Foundation Server at the moment.
    21 21   
     22 +`-p`, `--print`
     23 + Just print the URL. Do not open it in browser.
     24 + 
    22 25  `-h`
    23 26   Show a short help text.
    24  - 
    25 27   
    26 28  ## EXAMPLES
    27 29   
    skipped 22 lines
    50 52  If branches use naming convention of `issues/#123`, it opens
    51 53  https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/issues/123
    52 54   
     55 +```sh
     56 +git open --print
     57 +```
     58 + 
     59 +It prints the URL https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/
    53 60   
    54 61  ## SUPPORTED GIT HOSTING SERVICES
    55 62   
    skipped 82 lines
  • ■ ■ ■ ■ ■ ■
    test/git-open.bats
    skipped 35 lines
    36 36  }
    37 37   
    38 38  ##
     39 +## Print
     40 +##
     41 + 
     42 +@test "print url" {
     43 + git remote set-url origin "[email protected]:user/repo.git"
     44 + git checkout -B "master"
     45 + BROWSER="assert_failure" run ../git-open -p
     46 + assert_output "https://github.com/user/repo"
     47 +}
     48 + 
     49 +##
    39 50  ## url handling
    40 51  ##
    41 52   
    skipped 635 lines
Please wait...
Page is in error, reload to recover