mislav / hub

A command-line tool that makes git easier to use with GitHub.
https://hub.github.com/
MIT License
22.82k stars 2.19k forks source link

hub find files for shareability #2617

Open chernjie opened 4 years ago

chernjie commented 4 years ago

The problem I'm trying to solve:

I want a shareable link of a specific file or line range to be shared with my team mates for easy references

Use cases:

How I imagine hub could expose this functionality:

Opens the find/{ref} url on github

  1. hub find - opens find/{ref}
  2. hub find {filename} - opens find/{ref} and pre-fill the find textbox

image

Current proof of concept I have, named ~/bin/git-find

#!/usr/bin/env bash

__hub_find(){
    if test 0 -eq "$#"
    then
        hub browse -- find/$(git rev-parse --abbrev-ref HEAD)
        return $?
    fi

    hub browse -- search\?q=filename:"$*"
}

__hub_find "$@"
songz commented 4 years ago

really cool, could open up alot of possibilities.