extract-repo-url

Crates.ioextract-repo-url
lib.rsextract-repo-url
version1.0.1
sourcesrc
created_at2018-10-16 07:32:20.201811
updated_at2018-10-16 07:37:13.597734
descriptionSmall CLI tool to extract repository URL from text (from clipboard by default)
homepagehttps://github.com/rhysd/extract-repo-url#readme
repositoryhttps://github.com/rhysd/extract-repo-url
max_upload_size
id90925
size17,816
Linda_pp (rhysd)

documentation

README

extract-repo-url

Crates.io

Basic Usage

Outputs a repository URL extracted from clipboard text.

$ extract-repo-url # From clipboard by default
https://github.com/foo/bar

$ extract-repo-url 'Repository https://github.com/foo/bar is awesome' # Can receive text as 1st param
https://github.com/foo/bar

It can also detect

  • Clone URL (e.g. git@github.com:foo/bar.git -> https://github.com/foo/bar)
  • File page on github (e.g. https://foo.github.io/bar/tree/master/tests/data -> https://github.com/foo/bar)
  • GitHub pages (e.g. https://foo.github.io/bar/ -> https://github.com/foo/bar)
  • Bitbucket (e.g. foo bar https://bitbucket.org/foo/bar -> https://bitbucket.org/foo/bar)
  • GitLab (e.g. foo bar https://gitlab.com/foo/bar -> https://gitlab.com/foo/bar)

You can add more hosts with $EXTRACT_REPO_URL_SERVICE_HOSTS environment variable.

Please try --help option to see more details.

Use-cases

With Git:

$ git clone `extract-repo-url`

With open command (on macOS):

$ open `extract-repo-url`

Development

How to run test:

$ RUST_TEST_THREADS=1 cargo test

License

MIT

Commit count: 30

cargo fmt