open

command module
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2023 License: MIT Imports: 1 Imported by: 0

README

Open

open url in browser.

image

$ open alias ls | fzf --preview 'open alias info {}' --bind 'enter:execute(open alias run {})'

Installation

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:

## 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

$ open https://www.bilibili.com/
$ open url https://www.bilibili.com/
$ open /root/
open alias

User can add alias for url.

## 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

## Examples
$ open gh        -> open https://github.com
$ open gh .      -> open current dir(like `open gh repo`) 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 .    | open github repository in browser. eg: https://github.com/fzdwx/open

## 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

  • history
    • history record
    • history view
  • custom alias
    • add alias
    • delete alias
    • list alias

Documentation

Overview

Copyright © 2022 fzdwx <likelovec@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
cmd
gh
log
url
internal
env

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL