[ 03 ]Commands
copia-cli browse¶
copia-cli browse [<number> | <path> | <commit-sha>] [flags]
Open the repository's web page in the browser, or with an argument:
- a number ("42" or "#42"): that issue or pull request; Copia redirects an issue URL to the pull request with the same number;
- a commit SHA (7 to 64 hexadecimal characters): that commit;
- a path, optionally with a line or a line range ("main.st:12", "main.st:12-20"): that file or directory on the default branch, or on --branch or --commit. A relative path is taken from the current directory inside the repository, a path starting with "/" (or any path with -R) from the repository root.
--settings, --wiki, --releases, --actions and --projects open those pages of the repository and take no argument.
--commit without a SHA opens the last commit of the current branch (of the default branch with -R), read with one API call; give a SHA as --commit=<sha>. A path without --branch or --commit reads the default branch with one API call. Everything else makes no API call and needs no token. The browser is the command in COPIA_BROWSER, the config key browser or BROWSER, otherwise the system's default opener.
Options¶
-a,--actions- Open repository actions
--blame- Open blame view for a file
-b,--branch <string>- Select another branch by passing in the branch name
-c,--commit <string>- Select another commit by passing in the commit SHA, default is the last commit
-n,--no-browser- Print destination URL instead of opening the browser
-p,--projects- Open repository projects
-r,--releases- Open repository releases
-s,--settings- Open repository settings
-w,--wiki- Open repository wiki
Options inherited from parent commands¶
--host <string>- Target Copia host
-R,--repo <string>- Select repository (owner/repo)
--token <string>- Authentication token
Examples¶
# Open the current repository
$ copia-cli browse
# Open issue or pull request 42
$ copia-cli browse 42
# Open a commit
$ copia-cli browse 77507cd94ccafcf568f8560cfecde965fcfa63
# Open main.st at line 312
$ copia-cli browse main.st:312
# Open the blame view of main.st at line 312
$ copia-cli browse main.st:312 --blame
# Open main.st on the bug-fix branch
$ copia-cli browse main.st --branch bug-fix
# Open main.st at a commit
$ copia-cli browse main.st \
--commit=77507cd94ccafcf568f8560cfecde965fcfa63
# Open the repository settings
$ copia-cli browse --settings
# Print the URL of a pull request in another repository
$ copia-cli browse 7 -R my-org/my-repo --no-browser