giturl
is a helper for accessing GitHub web pages. Have you ever wanted to access a GitHub web page while working on a git-cloned local directory? You can use giturl
to display the URL corresponding to the git-managed directory given as an argument. And furthermore, if you want to access the URL immediately with your browser, girurl
opens your browser and automatically accesses the URL without your any operation on the browser. giturl
is a simple command. you can easily use from now on.
You can use giturl
like:
$ giturl .
https://github.com/shinyaohtani/giturl/tree/master/lib/giturl/
and --open
, or simply -o
option is given, your browser opens the URLs
$ giturl -o .
https://github.com/shinyaohtani/giturl/tree/master/lib/giturl/
# == your default browser automatically opens the URL ==
giturl [-o or --open] [-v or --verbose] dir1 [dir2, dir3, ...]
Then you will get each URLs corresponding to the specified directories, one per line.
If --verbose
is specified, print warnings for non-git-managed dirs:
$ giturl -v ~
Not git-managed-dir: /Users/myhome
Here is a example to open GitHub web page for current directory:
$ git clone [email protected]:shinyaohtani/giturl.git
$ cd giturl/lib/giturl/
# (working here)
# (some editing, like vim version.rb......)
# (then you want to access the GitHub web page for current dir.)
$ giturl -o .
https://github.com/shinyaohtani/giturl/tree/master/lib/giturl/
# == your default browser automatically opens the URL ==
Install giturl
as:
$ gem install giturl
Or add giturl
to your application's Gemfile and run bundle
command:
gem 'giturl'
Giturl
is also a module, so you can get urls from your ruby code.
(Giturl is a name of module version of giturl
)
require 'giturl'
path = './lib'
url = Giturl::Giturl.url(path)
p url unless url.nil?
See code
Refer to Changelog.md
Bug reports and pull requests are welcome!
- Fork it ( https://github.com/shinyaohtani/giturl )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
The gem is available as open source under the terms of the MIT License. Refer to LICENSE file