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

feat: support for creating multiple files using pattern. #404

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Mirsmog
Copy link

@Mirsmog Mirsmog commented Oct 1, 2024

Added Multi-File Creation Functionality

  • Now possible to create multiple files at once using the pattern {file1,file2,file3}.ext.
  • Updated action.create and action.create_from_prompt to use create_items for handling multiple files.
  • This allows generating several files in one go.
    example

Why This Matters:

This change speeds up the workflow by reducing the steps needed to create multiple files. It makes the process quicker and simpler, cutting down repetitive tasks.

I’m not a expert, but I believe this feature will make things easier for others and improve file management efficiency.

…file2,file3}.ext

- Added functionality to create multiple files at once using the pattern {file1,file2,file3}.ext
- Updated both action.create and action.create_from_prompt to use create_items for handling multiple files
- Users can now generate multiple files in one go, e.g., {index,about,contact}.html creates index.html, about.html, and contact.html.
@Mirsmog Mirsmog changed the title feat: added support for creating multiple files using pattern. feat: support for creating multiple files using pattern. Oct 2, 2024
…rsive path handling.

    Replaced single-level pattern expansion with a more robust method that accommodates recursive patterns within {}.
@jamestrew
Copy link
Collaborator

I like the idea of being able to use bash-style shell expansion to create files/folders.

But re-implementing shell expansions inside of telescope-file-browser however is almost certainly outside the scope of this plugin though. It gets much more complicated than just your implementation of splitting commas separated strings and I'm worried merging this is just going to invite more shell expansion support.
https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html

That's not to say it's impossible to support something like this. You could probably do something like creating a custom action to just os.execute("touch " .. input). But even this, I probably wouldn't include into the plugin because it's platform and shell dependent.

@Mirsmog
Copy link
Author

Mirsmog commented Oct 7, 2024

Thank you for your clarification. I hadn't fully considered that implementing this feature would require supporting the full spectrum of bash logic. Initially, I thought it might be feasible to include just the functionality demonstrated in the example without expanding to support additional bash features. However, you're right in suggesting that this could lead other users to expect complete bash functionality.

Regarding the use of touch via os.execute, I agree that this isn't a solution either, as it would introduce more complexity and dependencies.

Nevertheless, do you think it would be possible to integrate just this specific part of the functionality without adding the rest of the bash expansion logic? This could provide a useful feature while keeping the implementation simple.

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.

2 participants