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

New p module with FQ-folder-names #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

gustavnikolaj
Copy link
Owner

@gustavnikolaj gustavnikolaj commented Sep 29, 2022

The idea is to work as p but store repositories under their full origin url as the folder path - e.g. ~/Projects/github.com/gustavnikolaj/dotfiles

This is entirely parallel to the p-script and I don't plan on changing the original. There's value in it as it is.

I load the new variant as below in my .bashrc file.

# Load and configure p2.sh
export P2_DIR=~/Projects
source $DOTFILES_DIR/modules/p2/p2.sh

The command itself is actually called gg at the moment. It's easier to type than p2 and there was already something called Par Packager pp in /usr/bin... I don't know what the final name will be.

Usage:

$ gg gust dotfil
# turns into cd ~/git/github.com/gustavnikolaj/dotfiles

To move an existing repo into the structure there's a script called gg-move.

$ git clone git@github.com:gustavnikolaj/dotfiles.git dotfiles
$ gg-move dotfiles


About to move

  ~/Desktop/dotfiles

to

  ~/git/github.com/gustavnikolaj/dotfiles

Are you sure? [y/n]

Planned features

go to dir or checkout

$ gg git@github.com:gustavnikolaj/dotfiles.git
# either go to existing checkout in $PROJECTS_DIR/github.com/gustavnikolaj/dotfiles
# or checkout if it does not exist locally

@gustavnikolaj
Copy link
Owner Author

@papandreou I know that you at least used to use the p script. And I know that we've been talking about this before. If you want to take it for a spin I'd appreciate any feedback you might have.

@papandreou
Copy link
Contributor

I'm still using p 😍

My ${PROJECTS_DIR} is still flat so I don't think I'd have any use for p2?

@gustavnikolaj
Copy link
Owner Author

If you don't want to move from a flat to a nested structure then no :-) This is my idea for an alternate take on p which orders repositories into origin url based structures.

I haven't made up my mind on it yet, but it's been something I've wanted to test out for years. :-)

@papandreou
Copy link
Contributor

I haven't really experienced any downsides from using a flat structure, even though my ${PROJECTS_DIR} has 454 entries.

@gustavnikolaj
Copy link
Owner Author

Then I suppose this isn't for you. But that's also valuable feedback. Thanks :)

I've been thinking about doing this for a while. I'm still on the fence wether it's the right thing to do, so I'm trying it out for a while.

I have a couple of issues:

  1. Naming conflicts. I work on projects with identical names across different remotes or orgs on the same service.
  2. Then I have to come up with my own name - and my brain is not consistent and reliable enough to come up with the same name for the variants. So I end up with multiple versions of the same repo, or not being able to find a repo reliably with p.
  3. Discoverability. I check out the same repo over and over, and have no easy way of cleaning house.

I suppose the first two of these problems could be solved by just using the flat structure and naming two clashing repos with a more full version of their origin:

  • github.com/papandreou/dotfiles becoming github.com--papandreou--dotfiles
  • github.com/gustavnikolaj/dotfiles becoming github.com--gustavnikolaj--dotfiles

But the last one is the one I have struggled a bit with... I wanted to essentially be able to do p <copy/pasted git url> and end up in my local checkout if it's already there.

@gustavnikolaj
Copy link
Owner Author

I think I'm well within over-optimization territory and summoning you might just be what I need to refocus myself 😅

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