hub icon indicating copy to clipboard operation
hub copied to clipboard

hub find files for shareability

Open chernjie opened this issue 4 years ago • 1 comments

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:

  • share the URL with my team mates
  • if possible, generate the blob/{filename} url for share-ability
  • bonus, append specific line numbers e.g. blob/{filename}#L12:34

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 "$@"

chernjie avatar Sep 23 '20 18:09 chernjie

really cool, could open up alot of possibilities.

songz avatar Sep 23 '20 18:09 songz