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

Expose file and directory creation to plugin developers as part of fs #1709

Open
3 tasks done
hankertrix opened this issue Oct 1, 2024 · 0 comments · May be fixed by #2069
Open
3 tasks done

Expose file and directory creation to plugin developers as part of fs #1709

hankertrix opened this issue Oct 1, 2024 · 0 comments · May be fixed by #2069
Labels
feature New feature request

Comments

@hankertrix
Copy link
Contributor

hankertrix commented Oct 1, 2024

yazi --debug output

N/A

Please describe the problem you're trying to solve

There is already a function to remove files and directories inside the fs module, so having a function to create them would make it more convenient for plugin developers to create files and directories through Yazi instead of relying on shell commands.

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

Ideally, the function would be similar to the create file manager command that takes an Url as an input and a boolean argument to indicate whether a directory or file should be created, and maybe an additional argument for whether or not to overwrite the existing files, or rename the new files.

Additional context

For context, I am trying to create a custom version of the create file manager command to suit my needs, and exposing an API to create files and directories would make this possible without any external dependencies and will work on all systems.

Alternatively, having the create file manager command take a given path to create would also work, but wouldn't really make sense since no one would ever call the create command with a given path in their configuration.

Validations

  • I have searched the existing issues/discussions
  • The latest nightly build of Yazi doesn't already have this feature
@hankertrix hankertrix added the feature New feature request label Oct 1, 2024
hankertrix added a commit to hankertrix/yazi that referenced this issue Oct 13, 2024
It is mostly based on the create_do function.

Closes sxyazi#1709
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
1 participant