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

ignite s chain: allows to generate files in the current directory #2736

Closed
Tracked by #2923
lumtis opened this issue Aug 11, 2022 · 5 comments · Fixed by #3402
Closed
Tracked by #2923

ignite s chain: allows to generate files in the current directory #2736

lumtis opened this issue Aug 11, 2022 · 5 comments · Fixed by #3402
Assignees
Labels
component:design Design or UX improvements component:scaffold Feature, enhancement, or refactor related to scaffolding.

Comments

@lumtis
Copy link
Contributor

lumtis commented Aug 11, 2022

Is your feature request related to a problem or issue you encountered? Please describe.
Sometimes we want to create a new chain but we already have the git repo setup. Or recreating the chain in a new branch from a repo.

We should have an option to create the chain in the current dir without creating a git file. Same behavior as other scaffolding commands

Describe the solution you'd like

Introduce a flag like --unpack that performs this behavior

ignite s chain github.com/lubdt/foo --unpack
@lumtis lumtis added the type:request Feature request. label Aug 11, 2022
@fadeev
Copy link
Contributor

fadeev commented Aug 11, 2022

Interesting idea!

What if we make it more explicit by using a flag --skip-git, which will not init a git repo regardless if you're scaffolding a chain in a current directory or the regular way.

And modify the --path flag, so that passing . will scaffold a chain in a current dir.

The following will do what you propose:

ignite s chain github.com/lubdt/foo --skip-git --path .

This will create the files in hello/world without creating a foo directory.

ignite s chain github.com/lubdt/foo --skip-git --path hello/world

@lumtis
Copy link
Contributor Author

lumtis commented Aug 11, 2022

I would use --path . by default personally with --skip-git because if you don't want to init a git then means you have one

@fadeev fadeev added component:scaffold Feature, enhancement, or refactor related to scaffolding. and removed type:request Feature request. labels Sep 17, 2022
@aljo242
Copy link
Contributor

aljo242 commented Dec 16, 2022

@scottcarterco looking for some feedback here.

I personally think that we should not include the --skip-git flag.

Instead, we should check if a git repo exists or not in the given path. If git repo exists, we can prompt user if they want to use the existing repo. Else, we create one

@scottcarterco
Copy link
Contributor

scottcarterco commented Dec 16, 2022

Why not both? For developers who already know they want to skip, why not allow a flag to be appended so that it automatically knows to do so. Similar to specifying r for recursive. If that flag was not appended, we can prompt them with something such as A git repo already exists. Would you like to create a new one? Y/N or similar approach with different language.

@scottcarterco scottcarterco added the component:design Design or UX improvements label Dec 16, 2022
@tbruyelle
Copy link
Contributor

tbruyelle commented Dec 16, 2022

Jump on this:

For the path, I would act like git clone, bc developers are used to it:

  • git clone github.com/ignite/example will clone into a new directory called example
  • git clone github.com/ignite/example newdir will clone into a new directory called newdir
  • git clone github.com/ignite/example . will clone into the current directory.

For the skip git, the underlying code calls xgit.InitAndCommit() which does not invoke git init if the passed dir is already inside a git repository (this is a recent change), so you don't end up with multiple nested git repos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:design Design or UX improvements component:scaffold Feature, enhancement, or refactor related to scaffolding.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants