adding flexibility in view options
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.1k
- Forks
- 233
- Avg merge
- 1h 44m
- Merged PRs (30d)
- 1
Description
I am a total hobbyist at this stuff so do tell me if this is dumb or superfluous or whatever.
I enjoy using khal but miss some flexibility in displaying events. Mainly two things:
- I want to look not just days but also weeks or months ahead
- I sometimes want to look back in time
Eg, I want the following command to work:
khal list -3d 2w
which should list everything from 3 days ago up to 2 weeks into the future.
I've made a simple wrapper script that does just that. Works fine. But since it's still a wraparound and feels like the sort of thing that could be incorporated into khal itself, figured I'd post here.
#!/bin/zsh
#input variables
start="$1"
finish="$2"
#store other arguments
shift 2
#build start date
if [[ $start == "now" || $start == "yesterday" || $start == "tomorrow" ]]; then
khal_start=$start
elif [[ $start =~ ^-?[0-9]+[dwmy]$ ]]; then
number="${start%%[dwmy]}"
unit="${start: -1}"
case $unit in
d) unit_full=" days" ;;
w) unit_full=" weeks" ;;
m) unit_full=" months" ;;
y) unit_full=" years" ;;
esac
khal_start=$(date -d "$number$unit_full" "+%Y_%m_%d")
fi
#build finish date
if [[ $finish == "now" || $finish == "yesterday" || $finish == "tomorrow" ]]; then
khal_finish=$finish
elif [[ $finish =~ ^-?[0-9]+[dwmy]$ ]]; then
number="${finish%%[dwmy]}"
unit="${finish: -1}"
case $unit in
d) unit_full=" days" ;;
w) unit_full=" weeks" ;;
m) unit_full=" months" ;;
y) unit_full=" years" ;;
esac
khal_finish=$(date -d "$number$unit_full" "+%Y_%m_%d")
fi
khal list $khal_start $khal_finish $@
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the implementation of the khal list command and trace how its start and finish date arguments are parsed. Compare that behavior with the wrapper's handling of relative day, week, month, and year values, then verify that ranges such as khal list -3d 2w include the intended past and future events.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100