feat: add duplicate cron job functionality#58
Conversation
|
Hello @simon-suess! Thanks for this PR. A question: In which scenarios will be this useful? I mean, why would someone want to duplicate a cronjob? I am not saying this is not useful, I just want to understand the use case better. Thanks! |
|
Hello @antoniorodr, if you think that this feature is not needed or some people wouldn't or most people wouldn't use it, feel free to keep it out. I mainly did it for myself, but thought that contributing would be cool if other people needed it too. |
|
I will check the PR out. I understand the use case you are trying to address, and it does not seem like a bad idea to me. And it does not hurt to habe more options for users. I am feeling under the weather tho, but I will try to review it as soon as I can. Thanks for your patience! |
|
Hello @simon-suess! I have not forgotten about this PR, but I have been busy with other things. I will try to review it this week. Thanks for your patience! |
|
antoniorodr
left a comment
There was a problem hiding this comment.
I have added some comments to the PR. I have not checked all the files, because I prefer you to answer/fix this first.
Thanks for your patience!
| update_dependencies.py | ||
| test-server/ | ||
|
|
||
| .idea |
There was a problem hiding this comment.
What I meant was: why did you add this to the file?
| The default starting point for autocompletion is the home directory of the user whose cron jobs you are managing. Accept a suggestion with the `Tab` key. | ||
|
|
||
| ### 📋 Keyboard Shortcuts | ||
|
|
There was a problem hiding this comment.
They shortcurs are covered on the website documentation. That's why I didn't choose to have it on the README.md.
| identificator = row[0] | ||
| expr = row[1] | ||
| cmd = row[2] | ||
| log_enabled = row[3] == "True" # Convert string to bool |
There was a problem hiding this comment.
Why are you converting a bool to string? And why are you converting it this way?
| self.identificator = identificator | ||
| self.log_enabled = has_wrapper(command) if command else False | ||
| # If log_enabled is explicitly provided, use it; otherwise detect from command | ||
| self.log_enabled = log_enabled if log_enabled is not None else (has_wrapper(command) if command else False) |
There was a problem hiding this comment.
Here are you using self.log_enabled as a boolean, but on CronTable you are converting the value to a string.
What this changes
Duplicate cron jobs with
dkeybinding. Copies:_copysuffix (e.g.,backup_job→backup_job_copy)Updates:
CronTable:action_duplicate_cronjob()methodCronCreator: accepts optionallog_enabledparameterapp.py: passesduplicate_datadict to editorNO_ID_LABELconstant (DRY)How I tested this
CronTable_duplicate_test.pyChecklist