Project

giturl

0.0
Low commit activity in last 3 years
giturl: A simple navigation tool for GitHub pages from local git-cloned directories. Working deep in a git-cloned project and need to view its GitHub page? 'giturl' simplifies this for you. A single command unveils your repository's URL. Want more? It also opens your browser and goes straight to the page -- no extra steps needed. 'giturl' streamlines your workflow, merging simplicity with sophistication.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
>= 0.12.2
>= 3.9.0
>= 12.3.3
>= 3.9.0
>= 0.80.1
>= 1.38.1

Runtime

>= 2.5.0
 Project Readme

Gem Version

Welcome to giturl !

What is giturl?

giturl: A simple navigation tool for GitHub pages from local git-cloned directories. Working deep in a git-cloned project and need to view its GitHub page? giturl simplifies this for you. A single command unveils your repository's URL. Want more? It also opens your browser and goes straight to the page -- no extra steps needed. giturl streamlines your workflow, merging simplicity with sophistication.

You can use giturl like:

$ giturl .
https://github.com/shinyaohtani/giturl/tree/master/lib/giturl/

and --open, or simply -o option is given, your default browser opens the URLs

$ giturl -o .
https://github.com/shinyaohtani/giturl/tree/master/lib/giturl/
# == your default browser automatically opens the URL ==

Browser cooperation works on any OS of macOS, Windows and Linux.

Usage

Usage: giturl [options] [dirs]
 [dirs]:
   Target directories. Omit this when you only specify "."

 [options]:
    -o, --open                       Open the URL in your browser. default: no
    -a, --app [APPNAME]              Specify a browser. i.e. "Safari.app"
    -v, --verbose                    Verbose mode. default: no
    -h, --help                       Show this message
    -V, --version                    Show version

You can specify several directories at once. If --verbose is specified, print warnings for non-git-managed dirs:

$ giturl --verbose ~
Not git-managed-dir:  /Users/myhome

You can specify a browser to open:

### Chrome ###
$ giturl --open --app="Google\ Chrome.app" .
### Safari ###
$ giturl --open --app="Safari.app" .
### any other is ok ###
$ giturl --open --app="/Applications/any_browser_you_have.app" .

When you specify --app, you often forget to specify --open at the same time, but don't worry. If --app is specified and --open is forgotten, it automatically operates as if --open was specified.

If no directory is specified, the behavior is the same as when the current directory is specified.

$ giturl -o
$ giturl
#   These are completely same as:
$ giturl -o  .
$ giturl  .

Usecase

The following is an example of opening a GitHub web page for the current directory:

$ git clone git@github.com: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 ==

Installation

Install giturl as:

$ gem install giturl

Or add giturl to your application's Gemfile and run bundle command:

gem 'giturl'

Giturl module

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

Changelog

Refer to Changelog.md

Contributing

Bug reports and pull requests are welcome!

  1. Fork it ( https://github.com/shinyaohtani/giturl )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

The gem is available as open source under the terms of the MIT License. Refer to LICENSE file

RubyGems

https://rubygems.org/gems/giturl