Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions share/completion/cal
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# (C) 2025 unrealapex

# Completion script for cal

function completion/cal {

typeset OPTIONS ARGOPT PREFIX
OPTIONS=( #>#
"l; turn off highlighting of today"
"J; display Julian Calendar"
"e; display date of Easter"
"j; display Julian days"
"M; display monday as the first day of the week"
"m; display the specified *month*"
"o; display the date of Orthodox Easter"
"p; print the country codes and switching days from Julian to Gregorian Calendar"
"s; assume the switch from Julian to Gregorian Calendar at the date associated with *country_code*"
"w; print the number of the week below each week column"
"y; display a calendar for the specified *year*"
"3; display the previous, current, and next month"
"A; display the number of *months* after the current month"
"B; display the number of *months* before the current month"
"C; switch to cal mode"
"N; switch to ncal mode"
"d; use *yyyy-mm* as the current date (for debugging)"
"H; use *yyyy-mm-dd* as the current date (for debugging)"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POSIX defines no options for cal.
Can we complete these options only if cal is ncal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BSD cal does have options. I think we should check what version of cal is being ran and display completion accordingly similar to other completion scripts for commands that have different versions.

) #<#

command -f completion//parseoptions -es
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
esac

}


# vim: set ft=sh ts=8 sts=8 sw=8 et:
10 changes: 10 additions & 0 deletions share/completion/ncal
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# (C) 2025 magicant unrealapex

# Completion script for the "ncal" command.

function completion/ncal {
command -f completion//reexecute cal
}


# vim: set ft=sh ts=8 sts=8 sw=8 et: