-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathncal.ts
175 lines (174 loc) · 4.66 KB
/
ncal.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
export const monthSuggestions: Fig.Suggestion[] = [
"january",
"february",
"march",
"april",
"may",
"june",
"july",
"august",
"september",
"october",
"november",
"december",
].map((month) => ({ name: month, icon: "🗓", type: "arg" }));
const countryCodeSuggestion: Fig.Suggestion[] = [
["AL", "Albania"],
["AT", "Austria"],
["AU", "Australia"],
["BE", "Belgium"],
["BG", "Bulgaria"],
["CA", "Canada"],
["CH", "Switzerland"],
["CN", "China"],
["CZ", "Czech Republic"],
["DE", "Germany"],
["DK", "Denmark"],
["ES", "Spain"],
["FI", "Finland"],
["FR", "France"],
["GB", "United Kingdom"],
["GR", "Greece"],
["HU", "Hungary"],
["IS", "Iceland"],
["IT", "Italy"],
["JP", "Japan"],
["LI", "Lithuania"],
["LN", "Latin"],
["LU", "Luxembourg"],
["LV", "Latvia"],
["NL", "Netherlands"],
["NO", "Norway"],
["PL", "Poland"],
["PT", "Portugal"],
["RO", "Romania"],
["RU", "Russia"],
["SI", "Slovenia"],
["SW", "Sweden"],
["TR", "Turkey"],
["US", "United States"],
["YU", "Yugoslavia"],
].map((country) => ({
name: country[0],
description: country[1],
icon: "🌎",
type: "arg",
}));
const completionSpec: Fig.Spec = {
name: "ncal",
parserDirectives: {
optionsMustPrecedeArguments: true,
},
description: "Displays a calendar and the date of Easter",
options: [
{
name: "-h",
description: "Turns off highlighting of today",
},
{
name: "-J",
description:
"Display Julian Calendar, if combined with the -e option, display date of Easter according to the Julian Calendar",
},
{
name: "-e",
description: "Display date of Easter (for western churches)",
},
{
name: "-j",
description:
"Display Julian days (days one-based, numbered from January 1)",
},
{
name: "-m",
description:
"Display the specified month. If month is specified as a decimal number, it may be followed by the letter ‘f’ or ‘p’ to indicate the following or preceding month of that number, respectively",
exclusiveOn: ["-y", "-p"],
args: {
name: "month",
description:
"Display the specified month. If month is specified as a decimal number, it may be followed by the letter ‘f’ or ‘p’ to indicate the following or preceding month of that number, respectively",
suggestions: monthSuggestions,
},
},
{
name: "-y",
description: "Display a calendar for the specified year",
args: {
name: "year",
},
},
{
name: "-o",
description:
"Display date of Orthodox Easter (Greek and Russian Orthodox Churches)",
},
{
name: "-p",
description:
"Print the country codes and switching days from Julian to Gregorian Calendar as they are assumed by ncal. The country code as determined from the local environment is marked with an asterisk",
},
{
name: "-s",
description:
"Assume the switch from Julian to Gregorian Calendar at the date associated with the country_code. If not specified, ncal tries to guess the switch date from the local environment or falls back to September 2, 1752. This was when Great Britain and her colonies switched to the Gregorian Calendar",
args: {
name: "country_code",
suggestions: countryCodeSuggestion,
},
},
{
name: "-w",
description: "Print the number of the week below each week column",
},
{
name: "-3",
description:
"Display the previous, current and next month surrounding today",
exclusiveOn: ["-y", "-A", "-B", "-p"],
},
{
name: "-A",
description: "Display the number of months after the current month",
args: {
name: "number",
description: "Number of months to display",
},
},
{
name: "-B",
description: "Display the number of months before the current month",
args: {
name: "number",
description: "Number of months to display",
},
},
{
name: "-C",
description: "Switch to cal mode",
},
{
name: "-N",
description: "Switch to ncal mode",
},
{
name: "-d",
description:
"Use yyyy-mm as the current date (for debugging of date selection)",
args: {
name: "yyyy-mm",
description: "Date to use as the current date",
},
},
{
name: "-H",
description:
"Use yyyy-mm-dd as the current date (for debugging of highlighting)",
args: {
name: "yyyy-mm-dd",
description: "Date to use as the current date",
},
},
],
};
export default completionSpec;