https://github.com/fzdwx/open
open url in browser / disk
https://github.com/fzdwx/open
cli
Last synced: over 1 year ago
JSON representation
open url in browser / disk
- Host: GitHub
- URL: https://github.com/fzdwx/open
- Owner: fzdwx
- License: mit
- Created: 2022-08-28T08:27:27.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-10T08:28:02.000Z (over 2 years ago)
- Last Synced: 2025-02-08T19:47:02.517Z (over 1 year ago)
- Topics: cli
- Language: Go
- Homepage:
- Size: 7.76 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Open
open url in browser.

```bash
$ open alias ls | fzf --preview 'open alias info {}' --bind 'enter:execute(open alias run {})'
```
## Installation
```shell
go install github.com/fzdwx/open@latest
```
## about auth
1. use gh cli: `gh auth login`
2. or `export GH_TOKEN=xxx`
## use case
available commands:
```shell
## Commands
alias [subcommand] | Manage custom aliases
completion | Generate the autocompletion script for the specified shell
gh [search keyword] | [subcommand] | open github repo in browser
help [command] | Help about any command
history | Show open history
log | Show open log
url | open the specified url
```
### open url
open the specified url
```shell
$ open https://www.bilibili.com/
$ open url https://www.bilibili.com/
$ open /root/
```
### open alias
User can add alias for url.
```shell
## add
$ open alias add https://fzdwx.github.io/ --name blog
$ open alias add https://google.com/search?q=%s --name google
## delete
$ open alias remove blog
## list
$ open alias list
## run
$ open google "hello world"
```
### open gh
open github repo in browser
```shell
## Examples
$ open gh -> open https://github.com
$ open gh . -> open current dir in github
$ open gh fzdwx -> open https://github.com/search?q=fzdwx
$ open gh -l java sky -> open https://github.com/search?q=sky&l=java
$ open gh fzdwx -u -> https://github.com/search?q=fzdwx&type=users
## Commands
profile p | open your github profile in browser. eg: https://github.com/fzdwx
repo | search github repo. default is interactive
## Flags
-f, --closed | search issues,pr status is closed
-c, --commits | set search type is commits
-d, --debug | show log in console
-s, --discussions | set search type is discussions
-h, --help | help for gh
-i, --issues | set search type is issues
-l, --lang string | search programming languages. eg: go,java,rust
-m, --marketplace | set search type is marketplace
-o, --open | search issues,pr status is open
-g, --packages | set search type is packages
-p, --pr | set search type is pull requests
-r, --repo | set search type is repositories
-t, --topics | set search type is topics
-u, --users | set search type is users
-w, --wikis | set search type is wikis
```
## config (env)
```
GH_TOKEN=xxx
OPEN_PREVIEW=bat(fallback to cat)
```
## RodeMap
- [x] history
- [x] history record
- [x] history view
- [x] custom alias
- [x] add alias
- [x] delete alias
- [x] list alias