Skip to content

Commit

Permalink
Compatibility with gh 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
samcoe committed Aug 24, 2021
1 parent 4934181 commit e5b51eb
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 9 deletions.
1 change: 0 additions & 1 deletion README

This file was deleted.

21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# gh repo-explore

A [gh](https://github.com/cli/cli) extension for interactively exploring a repo without cloning the entire repo.

## installation

```sh
gh extension install samcoe/gh-repo-explore
```

## usage

```sh
# explore a repo
gh repo-explore samcoe/gh-repo-explore

# explore specific branch of a repo
gh repo-explore samcoe/gh-repo-explore --branch trunk
```

Supports `--hostname` flag to explore repos on hosts other than `github.com`.
40 changes: 40 additions & 0 deletions gh-repo-explore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
set -e

extensionPath="$(dirname "$0")"
arch="$(uname -m)"

if uname -a | grep Msys > /dev/null; then
if [ $arch = "x86_64" ]; then
exec "${extensionPath}/dist/gh-repo-explore_windows_amd64/gh-repo-explore" "$@"
elif [ $arch = "i686" ]; then
exec "${extensionPath}/dist/gh-repo-explore_windows_386/gh-repo-explore" "$@"
elif [ $arch = "i386" ]; then
exec "${extensionPath}/dist/gh-repo-explore_windows_386/gh-repo-explore" "$@"
fi
elif uname -a | grep Darwin > /dev/null; then
if [ $arch = "x86_64" ]; then
exec "${extensionPath}/dist/gh-repo-explore_darwin_amd64/gh-repo-explore" "$@"
fi
elif uname -a | grep Linux > /dev/null; then
if [ $arch = "x86_64" ]; then
exec "${extensionPath}/dist/gh-repo-explore_linux_amd64/gh-repo-explore" "$@"
elif [ $arch = "i686" ]; then
exec "${extensionPath}/dist/gh-repo-explore_linux_386/gh-repo-explore" "$@"
elif [ $arch = "i386" ]; then
exec "${extensionPath}/dist/gh-repo-explore_linux_386/gh-repo-explore" "$@"
fi
fi

if [ "$(which go)" = "" ]; then
echo "go must be installed to use this gh extension on this platform"
exit 1
fi

exe="cmd.out"

cd "${extensionPath}" > /dev/null
go build -o "${exe}"
cd - > /dev/null

exec "${extensionPath}/${exe}" "$@"
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/samcoe/gh-repo-explore
go 1.16

require (
github.com/alecthomas/chroma v0.9.1
github.com/gdamore/tcell/v2 v2.3.3
github.com/rivo/tview v0.0.0-20210601084449-25fe82727029
github.com/alecthomas/chroma v0.9.2
github.com/gdamore/tcell/v2 v2.4.0
github.com/rivo/tview v0.0.0-20210624165335-29d673af0ce2
)
11 changes: 6 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
github.com/alecthomas/chroma v0.9.1 h1:cBmvQqRImzR5aWqdMxYZByND4S7BCS/g0svZb28h0Dc=
github.com/alecthomas/chroma v0.9.1/go.mod h1:eMuEnpA18XbG/WhOWtCzJHS7WqEtDAI+HxdwoW0nVSk=
github.com/alecthomas/chroma v0.9.2 h1:yU1sE2+TZbLIQPMk30SolL2Hn53SR/Pv750f7qZ/XMs=
github.com/alecthomas/chroma v0.9.2/go.mod h1:eMuEnpA18XbG/WhOWtCzJHS7WqEtDAI+HxdwoW0nVSk=
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo=
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE=
Expand All @@ -15,8 +15,9 @@ github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
github.com/gdamore/tcell/v2 v2.3.3 h1:RKoI6OcqYrr/Do8yHZklecdGzDTJH9ACKdfECbRdw3M=
github.com/gdamore/tcell/v2 v2.3.3/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
github.com/gdamore/tcell/v2 v2.4.0 h1:W6dxJEmaxYvhICFoTY3WrLLEXsQ11SaFnKGVEXW57KM=
github.com/gdamore/tcell/v2 v2.4.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
Expand All @@ -28,8 +29,8 @@ github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRC
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/tview v0.0.0-20210601084449-25fe82727029 h1:6dS+di2EacbrIFK+h/NxaKZMiWvUDYKleaIWYuBVEMo=
github.com/rivo/tview v0.0.0-20210601084449-25fe82727029/go.mod h1:IxQujbYMAh4trWr0Dwa8jfciForjVmxyHpskZX6aydQ=
github.com/rivo/tview v0.0.0-20210624165335-29d673af0ce2 h1:I5N0WNMgPSq5NKUFspB4jMJ6n2P0ipz5FlOlB4BXviQ=
github.com/rivo/tview v0.0.0-20210624165335-29d673af0ce2/go.mod h1:IxQujbYMAh4trWr0Dwa8jfciForjVmxyHpskZX6aydQ=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
Expand Down

0 comments on commit e5b51eb

Please sign in to comment.