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

Create Backup Before File Modification #226

Open
r10r opened this issue Jun 21, 2022 · 5 comments
Open

Create Backup Before File Modification #226

r10r opened this issue Jun 21, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@r10r
Copy link

r10r commented Jun 21, 2022

Hi @TomWright,

when I use dasel I like to create a backup if it modifies a file.

Currently I use cp before running dasel to create the backup.
But I would prefer that dasel takes care of it.
What about implementing the following (global) commandline flags ?

 -b, --backup                  create a backup before writing the file
 --backup-suffix string        suffix to use for backup file (default .~)
@r10r r10r added the enhancement New feature or request label Jun 21, 2022
@TomWright
Copy link
Owner

All of the modifying commands support a -o or --out flag that allows you to change where the modified contents are written. I expect this largely covers this need, would you agree?

@r10r
Copy link
Author

r10r commented Jun 22, 2022

Hmm, I'm unsure. How would you use the --out flag to modify a config file and create a backup within a single command?

@TomWright
Copy link
Owner

It's more that using the --out flag tells dasel to write the modified file to a new location.

@r10r
Copy link
Author

r10r commented Jun 25, 2022

So wouldn't the --backup flag would be a nice addition then ?

@TomWright
Copy link
Owner

Yeah I think it could help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants