Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows custom folder name #82

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

soraxas
Copy link
Contributor

@soraxas soraxas commented May 29, 2020

This PR adds the ability to clone into a named folder (same as the normal git clone command where you can clone to any folder), with the exception that it's to rename the result folder.

Use case: I uses lots of gist to host the script that I used (and easy to share). My basher list looks something like:

dylanaraps/neofetch
pepa65/tldr-bash-client
simonthum/git-sync
so-fancy/diff-so-fancy
soraxas/0ef22338ad01e470cd62595d2e5623dd
soraxas/4c54c944714412baeb1b773ff10d7261
soraxas/507cbff5fab0a10f71cdc4b9179e3e36
soraxas/711591894b79be8916ef85307f1a3552
soraxas/72ed82761fc7435e8d2bf4d2043d641f
soraxas/735c512a785b8278b9faffdbb303b37b
soraxas/ab594b0cf5c49b4e36c04249f0b7c2f7
soraxas/dot-reminder
soraxas/works

which is impossible to know what those packages are for (because github gist cannot be renamed).

With this PR, I can install package with

basher install gist.github.com/soraxas/735c512a785b8278b9faffdbb303b37b git-utils

i.e.

Usage: basher install [--ssh] [site]/<package>[@ref] [folder]

and it will clone into cellar/soraxas/git-utils. The result is:

dylanaraps/neofetch
pepa65/tldr-bash-client
simonthum/git-sync
so-fancy/diff-so-fancy
soraxas/close-gnome-terminal
soraxas/dot-reminder
soraxas/easy-extraction
soraxas/gist-add-x-bit
soraxas/git-utils
soraxas/open-rev-ports
soraxas/parse-assh
soraxas/pdfcrop
soraxas/works

In addition, to enhance the basher list functinoality, it now has a verbose flag -v where if you run

basher list -v

it will displays the upstream URL (also useful to shows hostname other than github.com), like so:

dylanaraps/neofetch            (https://github.com/dylanaraps/neofetch.git)
pepa65/tldr-bash-client        (https://github.com/pepa65/tldr-bash-client.git)
simonthum/git-sync             (https://github.com/simonthum/git-sync.git)
so-fancy/diff-so-fancy         (https://github.com/so-fancy/diff-so-fancy.git)
soraxas/close-gnome-terminal   (https://gist.github.com/soraxas/711591894b79be8916ef85307f1a3552.git)
soraxas/dot-reminder           (https://github.com/soraxas/dot-reminder.git)
soraxas/easy-extraction        (https://gist.github.com/soraxas/ab594b0cf5c49b4e36c04249f0b7c2f7.git)
soraxas/gist-add-x-bit         (https://gist.github.com/soraxas/507cbff5fab0a10f71cdc4b9179e3e36.git)
soraxas/git-utils              (https://gist.github.com/soraxas/735c512a785b8278b9faffdbb303b37b.git)
soraxas/open-rev-ports         (https://gist.github.com/soraxas/0ef22338ad01e470cd62595d2e5623dd.git)
soraxas/parse-assh             (https://gist.github.com/soraxas/72ed82761fc7435e8d2bf4d2043d641f.git)
soraxas/pdfcrop                (https://gist.github.com/soraxas/4c54c944714412baeb1b773ff10d7261.git)
soraxas/works                  (https://gist.github.com/soraxas/4c54c944714412baeb1b773ff10d7261.git)

@pawamoy
Copy link
Contributor

pawamoy commented May 30, 2020

Nice! I'd love to be able to specify both the namespace and package name though, something like basher install gh:shellm-org/loop shellm/loop. It would effectively allow to install from any mirror with different namespaces.

@soraxas
Copy link
Contributor Author

soraxas commented May 31, 2020

@pawamoy see #70 for that

@pawamoy
Copy link
Contributor

pawamoy commented Jun 1, 2020

Sorry, I used the cookiecutter syntax for the URL 😅

What I really meant was basher install github.com/shellm-org/loop shellm/loop. This way users could install my packages from my GitHub org shellm-org or the GitLab one shellm under the same namespace: shellm.

@soraxas
Copy link
Contributor Author

soraxas commented Jun 1, 2020

True, I would agree that it would be a more flexible approach.

With the updated PR, one must specify the optional folder in the <...>/<...> format, i.e.

basher install gist.github.com/me/89271498214 foo/bar

Though that begs the question of whether a package must be in the format of <username>/<repo>. But until we want to relax that constrain (and closes #67), this is at least consistent to the current behaviour.

@pawamoy
Copy link
Contributor

pawamoy commented Jun 1, 2020

Great, thanks for the update 🙂

@juanibiapina
Copy link
Member

This is great, thanks for the contributions. It's missing tests though, if you're still interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants