Skip to content

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

@hankertrix

Description

@hankertrix

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions