jazzband / Watson

:watch: A wonderful CLI to track your time!
http://tailordev.github.io/Watson/
MIT License
2.46k stars 240 forks source link

Watson does not update the configuration #492

Open Issam2204 opened 1 year ago

Issam2204 commented 1 year ago

I used the following command to update the options of watson:

watson config -e

After saving, I get the following error as I exit the editor:

Traceback (most recent call last):
  File "/home/issam/.local/bin/watson", line 5, in <module>
    from watson.__main__ import cli
  File "/home/issam/.local/lib/python3.10/site-packages/watson/__main__.py", line 3, in <module>
    cli.cli()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/issam/.local/lib/python3.10/site-packages/watson/cli.py", line 136, in wrapper
    return func(*args, **kwargs)
  File "/home/issam/.local/lib/python3.10/site-packages/watson/cli.py", line 1465, in config
    safe_save(watson.config_file, newconfig)
  File "/home/issam/.local/lib/python3.10/site-packages/watson/utils.py", line 252, in safe_save
    shutil.move(path, path + ext)
  File "/usr/lib/python3.10/shutil.py", line 813, in move
    raise Error("Destination path '%s' already exists" % real_dst)
shutil.Error: Destination path '/home/issam/.config/watson/config.bak/config' already exists

I think watson should force the overwrite.

This is not blocking as I can edit the config file myself with nano/vim.