Function Reference: find_GHurls

pkg-octave-doc: pkgfcns = find_GHurls (pkgurl, pkgfcns)

Retrieve unique URLs to every function’s location within the package’s GitHub repository.

find_GHurls requires two input arguments, pkgurl, a char string with the URL to the root directory to the package’s GitHub repository and pkgfcns, a Nx2 cell array containing the package’s available functions (1st column) and their respective category (2nd column).

Note: find_GHurls explicitly works with repositories hosted on GitHub! pkgurl can be easily retrieved from the PKG_URL field of the info structure returned from package_texi2html.

find_GHurls returns a cell array, pkgfcns, by appending a third column to the input pkgfcns with the URLs to the source code location of each individual function listed in the 1st column of pkgfcns.

A URL takes one of two forms, and which one it takes says whether a line number may be appended to it. blob/commit names the commit the archive was cut from, and is used only where the archived file and the installed file hold the same text, so a line counted in the one is the line in the other. tree/HEAD names the default branch instead, and is used wherever the two differ or the commit could not be read; a line number must not be appended to such a URL, the file it names being free to change. find_GHurls relies on curl and tar, which must be installed and available to the system’s $PATH, and an active internet connection to download and extract the targeted repository to a temporary directory. If either curl or tar fail for any reason, find_GHurls returns a verbatim copy of the input pkgfcns.

Use the following example to obtain a cell array with each function’s URL to its source code location at GitHub:

 
 [pkgfcns, info] = package_texi2html ("pkg-octave-doc");
 pkgfcns = find_GHurls (info.PKG_URL, pkgfcns);

See also: function_texi2html

Source Code: find_GHurls