refactor: improve usage docs & help

pull/25/head
sgoudham 1 year ago committed by Hamothy
parent 367c1421bb
commit 98cbfcc226

@ -45,33 +45,47 @@ brew install git-view
```shell ```shell
$ git view $ git view
# View https://github.com/TRACKED_REMOTE_USER/REPO/tree/CURRENT_BRANCH # https://github.com/TRACKED_REMOTE_USER/REPO/tree/CURRENT_BRANCH
$ git view --remote remote $ git view --remote remote
# View https://github.com/PROVIDED_REMOTE_USER/REPO/tree/CURRENT_BRANCH # https://github.com/PROVIDED_REMOTE_USER/REPO/tree/CURRENT_BRANCH
$ git view --remote remote --branch branch $ git view --remote remote --branch branch
# View https://github.com/PROVIDED_REMOTE_USER/REPO/tree/PROVIDED_BRANCH # https://github.com/PROVIDED_REMOTE_USER/REPO/tree/PROVIDED_BRANCH
$ git view --issue
# Given branch 'TICKET-123' or some other variation
# https://github.com/TRACKED_REMOTE_USER/REPO/issues/123
$ git view --issue 42
# https://github.com/TRACKED_REMOTE_USER/REPO/issues/42
$ git view --commit $ git view --commit
# View https://github.com/TRACKED_REMOTE_USER/REPO/tree/CURRENT_COMMIT # https://github.com/TRACKED_REMOTE_USER/REPO/tree/CURRENT_COMMIT
$ git view --commit efa38be50ad34d $ git view --commit efa38be50ad34d
# View https://github.com/TRACKED_REMOTE_USER/REPO/tree/efa38be50ad34d # https://github.com/TRACKED_REMOTE_USER/REPO/tree/efa38be50ad34d
$ git view --issue $ git view --commit efa38be50ad34d --path src/lib.rs
# Given branch 'TICKET-123' or some other variation # https://github.com/TRACKED_REMOTE_USER/REPO/tree/efa38be50ad34d/src/main.rs
# View https://github.com/TRACKED_REMOTE_USER/REPO/issues/123
$ git view --issue 42 $ git view --path
# View https://github.com/TRACKED_REMOTE_USER/REPO/issues/42 # Given working directory 'src/lib.rs'
# https://github.com/TRACKED_REMOTE_USER/REPO/tree/CURRENT_BRANCH/src/main.rs
$ git view --path CONTRIBUTING.md
# https://github.com/TRACKED_REMOTE_USER/REPO/tree/CURRENT_BRANCH/CONTRIBUTING.md
$ git view --path CONTRIBUTING.md --branch testing
# https://github.com/TRACKED_REMOTE_USER/REPO/tree/PROVIDED_BRANCH/CONTRIBUTING.md
$ git view --suffix releases $ git view --suffix releases
# Given branch 'TICKET-123' or some other variation # Given branch 'TICKET-123' or some other variation
# View https://github.com/TRACKED_REMOTE_USER/REPO/releases # https://github.com/TRACKED_REMOTE_USER/REPO/releases
$ git view --print $ git view --print
# Prints https://github.com/TRACKED_REMOTE_USER/REPO/tree/CURRENT_BRANCH # prints https://github.com/TRACKED_REMOTE_USER/REPO/tree/CURRENT_BRANCH
``` ```
## Help ## Help
@ -89,12 +103,14 @@ OPTIONS:
[default: default remote] [default: default remote]
-b, --branch <name> The branch to view git repository on -b, --branch <name> The branch to view git repository on
[default: current branch] [default: current branch]
-i, --issue <number> The issue number to view on the git repository
[default: open issue from current branch]
-c, --commit <hash> The commit to view git repository on -c, --commit <hash> The commit to view git repository on
[default: current commit] [default: current commit]
-s, --suffix <suffix> A suffix to append onto the git repository URL -p, --path <path> The directory/file to view on the git repository
-i, --issue <issue> The issue number to view [default: current working directory]
[default: open issue from remote branch] -s, --suffix <suffix> A suffix to append onto the base git repository URL
-p, --print Don't open browser and print the URL --print Don't open browser and print the URL
-h, --help Print help information -h, --help Print help information
-V, --version Print version information -V, --version Print version information
``` ```

@ -40,6 +40,7 @@ fn main() {
.long_help("The issue number to view on the git repository\n[default: open issue from current branch]") .long_help("The issue number to view on the git repository\n[default: open issue from current branch]")
.short('i') .short('i')
.long("issue") .long("issue")
.value_name("number")
.default_missing_value("branch") .default_missing_value("branch")
.conflicts_with("commit") .conflicts_with("commit")
.takes_value(true) .takes_value(true)

Loading…
Cancel
Save