Skip to main content

No project description provided

Project description

githyperlink

Get a link to the hosted html version of a git-tracked file or directory.

This is relevant only for git remotes that serve html, like github and gitlab.

Usage

$ gethyperlink [PATH]

(Note the spelling here: get hyperlink).

If PATH is not specified, a link for the current directory is given.

Example

$ cd my-pretty-repo/subdir

$ gethyperlink somefile.jl
https://github.com/yourname/my-pretty-repo/blob/main/subdir/somefile.jl

You might want to define an alias, for example, in ~/.bashrc:

alias gl="gethyperlink"  # Or maybe 'gurl' (get url) 💅

Direct usage in Python

from githyperlink import get_hyperlink

print(get_hyperlink(__file__))
# → https://gitlab.com/you/my_scripts/blob/main/this_script.py

The argument to get_hyperlink can be a string, as above, or a pathlib.Path.

Installation

pip install githyperlink

This will get you the

Latest release on PyPI,

and makes the command-line tool gethyperlink globally available.

To upgrade an existing installation to the version above, use pip install -U githyperlink.

Requires Python ≥ 3.9.

Features

  • git is called directly, in a subprocess: this is faster than the default usage of GitPython, and spares a dependency. (Currently, we only depend on click).

  • Not many features.
    This makes the source code easier to grok, and easier to modify for your own purposes.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

githyperlink-0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

githyperlink-0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page