git-bro
Version:
CLI tool that lets you download specific folders from GitHub repositories without cloning the entire repo.
12 lines (11 loc) • 330 B
JavaScript
const parseGitHubUrl = (url) => {
const urlParts = url.split('/');
const owner = urlParts[3];
const repo = urlParts[4];
const branch = urlParts[6] || 'main';
const folderPath = urlParts.slice(7).join('/');
return { owner, repo, branch, folderPath };
};
module.exports = {
parseGitHubUrl
};