Skip to content

Add configurable overwrite defaults #60

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

Open
dshoreman opened this issue Jun 8, 2019 · 0 comments
Open

Add configurable overwrite defaults #60

dshoreman opened this issue Jun 8, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@dshoreman
Copy link
Owner

dshoreman commented Jun 8, 2019

Now that #50 is fixed so that duplicate uploads return a link, we could really do with a way of preventing Nextshot from overwriting existing files.

Nextcloud automatically overwrites, so we would need to ping the webdav API prior to sending the upload request. If a file exists with the same name, the user should be able to decide how to proceed.

Rename/overwrite/abort prompt is taken care of with #83, leaving only config/runtime args:

Config Option

There should be an option in nextshot.conf to define the default behaviour.
Something like overwrite=<action> could work, with possible values of:

  • overwrite=always - overwrite automatically without asking (previous behaviour)
  • overwrite=append - automatically append iterator/timestamp to the filename
  • overwrite=rename - never overwrite, ask for a new filename each time
  • overwrite=prompt - ask whether to overwrite or rename at runtime (current behaviour)
  • overwrite=cancel - always abort the upload(?)

The best option to set by default if the config isn't set would probably be prompt. The idea of Nextshot is to minimise interaction though, so perhaps always would be the better default here.

Runtime Args

While a config option should cover most cases, there should also be ways of overriding it on a case-by-case basis.

  • --no-overwrite would be useful if config is set to always
  • --overwrite could likewise be handy for bypassing prompts occasionally

How useful these would be though is questionable. Maybe skip them unless someone really wants it - the config option is still better than always overwriting without any choice in the matter.

Caveats

  • Appending to the filename automatically is good in theory, but in practice it's not so easy to implement. Extra care would need to be taken to avoid somefile-1-1-1-1-1.png or bumping to somefile-2.png only to find that also exists. Possibly leave this option for a later release.
  • Aborting upload really isn't the most useful option, so that can probably be ignored.
@dshoreman dshoreman added the enhancement New feature or request label Jun 9, 2019
@dshoreman dshoreman changed the title Prompt before overwriting Add configurable overwrite defaults May 6, 2023
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

1 participant