ui icon indicating copy to clipboard operation
ui copied to clipboard

CLI should remember path or better default

Open l-mbert opened this issue 1 year ago • 2 comments

I use the CLI to add components and it has become somewhat tedious to always type out the path where to put them.

I have three solutions in mind and would be willing to implement them:

  1. Adding a configuration file

We could add a file called "shadcn.config.js" or something similar. I don't quite like this idea because it would add a file while the rest leaves no trace of being generated by this package. It would add the benefit that everyone who uses the repo automatically has the correct path specified and it's source controlled. It could also be used for more configuration options later.

  1. Remember the choice

We could save the choice in a cache-file for the current folder and apply it as a default. This would only work for the current user and not any other people using the codebase.

  1. Scanning the codebase (not really a perfect solution but a quality of life improvement)

We could scan the codebase either for the "src" folder or for files we know did come from us. This could take some time though and the CLI might feel unresponsive. This also leaves out the possibility that the user has changed the name of the file.

If I personally could decide I would opt for a mixture between 2 and 3. I believe shadcn/ui has it's beauty because of the copy and paste aspect and adding a file to a repo would kind of defeat it's purpose. I would initally scan for the "src" directory for users which use it to provide a better default. If the user decides to provide a complete different path I would add it to a temporary or persistent file and keep a dictonary of folders and paths.

l-mbert avatar May 14 '23 22:05 l-mbert