Add dadd package#228
Conversation
| homepage: "https://github.com/undergrinder/espanso-hub/tree/main/packages/dadd/0.1.0" | ||
| version: 0.1.0 | ||
| author: undergrinder | ||
| tags: ["math", "utility"] |
There was a problem hiding this comment.
Would you kindly add some additional tags, such as "date", "python" etc. as in my own date-offset packages, please?
There was a problem hiding this comment.
Sure, thank you for all the observation, I try to fix all of them as soon as possible.
There was a problem hiding this comment.
You're welcome. Let me know if you'd like any help.
|
|
||
| The output will be also in YYYY-MM-DD format. | ||
|
|
||
| # Installation |
There was a problem hiding this comment.
You could omit installation instructions as they'll be added to the Hub page automatically.
I suppose there's an argument for including them in case someone is browsing the espanso/hub repo instead, but the espanso restart will happen automaticaly so isn't required anyway.
|
|
||
| The package contain only one trigger that is :dadd (short for date add). | ||
|
|
||
|  |
There was a problem hiding this comment.
I like the inclusion of the screenshot. We might find the Hub frontend fails as a result, however. Let's see!
smeech
left a comment
There was a problem hiding this comment.
A small package with a single trigger and a straightforward Python script, not unlike the one I used in my own package. No potentially malicious code, AFAICS.
I've left a couple of suggestions, will let Copilot do its stuff, and I'll run the automated checks to see if it balks at the README.md image.
Thank you.
There was a problem hiding this comment.
Pull request overview
Adds a new Espanso Hub package (dadd) that provides a :dadd form-based trigger for adding/subtracting days from a base date and outputting the resulting date.
Changes:
- Added
:daddmatch with a form input and a Python-backed date calculation script. - Added package documentation (README + screenshot).
- Added package manifest metadata for Hub distribution.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| packages/dadd/0.1.0/package.yml | Defines the :dadd trigger, collects form inputs, and computes the resulting date via Python. |
| packages/dadd/0.1.0/README.md | Documents usage, inputs, and installation steps with a screenshot. |
| packages/dadd/0.1.0/_manifest.yml | Adds Hub metadata (name, version, homepage, tags). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| dt = datetime.strptime(clean_input, '%Y-%m-%d') | ||
| print(f"{dt + timedelta(days=int('{{input_dateadd.dayTimeDelta}}'))}") |
There was a problem hiding this comment.
I agree. 1958-03-18 00:00:00 doesn't really make sense when all you want is 1958-03-18.
| - -c | ||
| - | | ||
| from datetime import datetime, timedelta | ||
| clean_input = '{{input_dateadd.dateBase}}'.strip("' \"").replace('.', '-') |
| from datetime import datetime, timedelta | ||
| clean_input = '{{input_dateadd.dateBase}}'.strip("' \"").replace('.', '-') | ||
| if clean_input in ['now', 'today']: |
There was a problem hiding this comment.
I don't think that's necessary - the trigger will simply fail if the user enters invalid characters.
| This package is an utility for quick date calculation like insert the date that is +12 from tomorrow, | ||
| or -5 day from today. | ||
|
|
||
| The package contain only one trigger that is :dadd (short for date add). |
| The form has two field: | ||
| - Day num: Number of days to add or extract. For extraction use negative number. | ||
| - Date base (YYYY-MM-DD format): The date that will be used for add or extract. 'Today' and 'Now' are also valid values. 'Today' is the default. |
| @@ -0,0 +1,7 @@ | |||
| name: "dadd" | |||
| title: "Date add package" | |||
| description: An utility for quick date calculations | |||
There was a problem hiding this comment.
I agree, it would be nice. The description: value forms the text at the top of the package's Hub page.
This package is an utility for quick date calculation like insert the date that is +12 from tomorrow, or -5 day from today.