-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
Add --preserve-host flag and GHORG_PRESERVE_HOSTNAME Environment Variable #282
Comments
Thanks for raising this thoughtful issue @rrrix! Great to hear how you're using ghorg too! I do see some value in this feature. However, I'm not sure when I'll have to time to get around to it. In the meantime, what I would suggest trying is the
This will put both inside your ghorg dir but you'll be able to tell them apart much easier. |
Feature Request
Please add a flag
--preserve-host
, similar to--preserve-dir
.Also, an environment variable
GHORG_PRESERVE_HOSTNAME
, similar toGHORG_PRESERVE_DIRECTORY_STRUCTURE
.This should result in the behavior described below.
Examples
Generic
Given the variables:
SCM_HOST=git.example.com SCM_URL=https://${SCM_HOST}/
The command:
would clone to:
${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/${SCM_HOST}/${ORG}
GitHub Example:
ghorg clone --scm=github --preserve-host kubernetes
would clone to${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/github.com/kubernetes
.GitLab Example:
ghorg clone --scm=gitlab --preserve-host gitlab-org
would clone to${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/gitlab.com/gitlab-org
GitLab Self-Hosted Example:
ghorg clone --scm=gitlab --preserve-host --base-url=https://my.gitlab.instance.example.com/ some-gitlab-org
would clone to${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/my.gitlab.instance.example.com/some-gitlab-org
BitBucket Example:
ghorg clone --scm=gitlab --preserve-host --base-url=https://my.bitbucket.instance.example.com/ some-bitbucket-group
would clone to${GHORG_ABSOLUTE_PATH_TO_CLONE_TO}/my.bitbucket.instance.example.com/some-bitbucket-group
Describe alternatives you've considered
I currently use of the
--path
option to manually point my clones to~/ghorg/{scm-hostname}/${org-name}
, but this makes usingghorg reclone
a little too verbose for my liking, as thereclone.yml
file does not support environment variables (e.g.$HOME
).Using
vmware
1, 2 andsaltstack
3, 4 as examples, which have both GitLab.com and GitHub.com organizations, if I could setGHORG_PRESERVE_HOSTNAME
in my~/.config/ghorg/conf.yaml
, I could then simplify myreclone.yaml
as:It currently looks like:
`~/.config/ghorg/reclone.yaml` with absolute paths
Not to mention self-hosted GitLab, BitBitbucket, and more...
Additional Context
I use
ghorg
frequently, it's awesome!! As part of my role as a Security Operations Software Engineer, I'm constantly looking toghorg
(and frequently combine it with tools likeag
) to perform software reviews, analysis and other activities. The killer feature is the ability to clone entire orgs across multiple SCM's, Cloud-Hosted or Self-Hosted.Before ghorg, I did this all by hand with custom Python tooling that I had to build and maintain. Thanks
@gabrie30
!The text was updated successfully, but these errors were encountered: