fw icon indicating copy to clipboard operation
fw copied to clipboard

add option to keep projects in nested directories

Open LordMZTE opened this issue 4 years ago • 23 comments

I personally like keeping my projects in a nested directory. For example, if I'm working on a project foo, then the git repo would be cloned at ~/dev/foo/foo. With this structure, I can keep additional things needed (such as testing environments) for foo in the outer foo directory, without interfering with the repo. However, fw doesn't seem to support this. It would be really awesome to have this, as fw currently wouldn't work with some of my projects for that reason.

LordMZTE avatar Jun 11 '21 20:06 LordMZTE

I am aware that it is possible to do this by setting override_path, but it is really annoying doing this for every project, instead of it defaulting to that path when using the add command.

LordMZTE avatar Jun 11 '21 21:06 LordMZTE

I think this is related to https://github.com/brocode/fw/issues/23 @mriehl any other ideas?

bomgar avatar Jun 12 '21 18:06 bomgar

Yeah, it seems to be related, if #23 were implemented that should fix my issue.

LordMZTE avatar Jun 13 '21 20:06 LordMZTE

Yeah I also agree this is something #23 could tackle (along with a slew of other customizations). I guess there is a workaround where you can "implement" your logic in a shell alias, by saying something like:

/usr/bin/fw-add-nested:

#!/bin/bash

REMOTE=${1:?"Usage: $0 <git remote>"}
NAME=$(echo "$REMOTE" | cut -d "/" -f2 | tr -d ".git")

fw add "$REMOTE" --override-path "/tmp/$NAME/$NAME"

and then you can just do fw-add-nested [email protected]:foo/bar.git

It isn't the sexiest but that would work with unlimited flexibility today and we won't break CLI backwards compatibility especially in the case of something like fw add.

mriehl avatar Jun 14 '21 05:06 mriehl

This breaks fw sync.

On Mon, Jun 14, 2021, at 07:07, Maximilien Riehl wrote:

Yeah I also agree this is something #23 https://github.com/brocode/fw/issues/23 could tackle (along with a slew of other customizations). I guess there is a workaround where you can "implement" your logic in a shell alias, by saying something like:

/usr/bin/fw-add-nested:

`#!/bin/bash

REMOTE=${1:?"Usage: $0 "} NAME=$(echo "$REMOTE" | cut -d "/" -f2 | tr -d ".git")

fw add "$REMOTE" --override-path "/tmp/$NAME/$NAME" `

and then you can just do fw-add-nested ***@***.***:foo/bar.git

It isn't the sexiest but that would work with unlimited flexibility today and we won't break CLI backwards compatibility especially in the case of something like fw add.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/brocode/fw/issues/187#issuecomment-860365504, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADCFBD2L6AZSJRKHPO6DVLTSWFAXANCNFSM46RN6IQA.

bomgar avatar Jun 14 '21 05:06 bomgar

@bomgar what do you mean it breaks fw sync? It's basically just a project with override path. Do you mean there's a mkdir -p missing somewhere in the sync code because the parent dir basically doesn't exist?

mriehl avatar Jun 14 '21 05:06 mriehl

A sorry I should no reply to threads after waking up.

bomgar avatar Jun 14 '21 05:06 bomgar

@LordMZTE is the workaround working for you? Or are you planning on working on the issue yourself? Or should we implement something if we decide what to do and have the time to implement it?

bomgar avatar Jun 14 '21 09:06 bomgar

I haven't tried the workaround yet, but once we decide what to do in #23 I'd be happy to contribute!

LordMZTE avatar Jun 14 '21 10:06 LordMZTE