* cal: column mode
@ 2020-04-13 20:41 Aurélien Lajoie
2020-04-14 11:38 ` Karel Zak
0 siblings, 1 reply; 7+ messages in thread
From: Aurélien Lajoie @ 2020-04-13 20:41 UTC (permalink / raw)
To: util-linux
Hi,
As I have announced few days ago, I have started to work on ncal like for cal.
I have push a first working version on my github:
https://github.com/utix/util-linux/commits/cal_column
I will now add some tests, and improve my code.
Does anyone know which locale can have some width issue ?
I have tried to keep the same structure of the code between the column
mode and the row mode.
It is impossible to keep line width lower than 80.
I can try to split the big function `cal_output_months` this will make
it more readable, but will introduce a lot of change for no feature.
Any advice on this ?
Thanks
Ôrel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: cal: column mode
2020-04-13 20:41 cal: column mode Aurélien Lajoie
@ 2020-04-14 11:38 ` Karel Zak
2020-04-14 20:18 ` Aurélien Lajoie
0 siblings, 1 reply; 7+ messages in thread
From: Karel Zak @ 2020-04-14 11:38 UTC (permalink / raw)
To: Aurélien Lajoie; +Cc: util-linux
On Mon, Apr 13, 2020 at 10:41:34PM +0200, Aurélien Lajoie wrote:
> As I have announced few days ago, I have started to work on ncal like for cal.
> I have push a first working version on my github:
> https://github.com/utix/util-linux/commits/cal_column
Is the option --column the best name? We use "column" pretty often to
address output in columns or number of columns, etc.
What about --vertical?
> I will now add some tests, and improve my code.
Cool.
> Does anyone know which locale can have some width issue ?
LC_ALL=ja_JP.utf8 cal
or another with multibyte letters.
> I have tried to keep the same structure of the code between the column
> mode and the row mode.
> It is impossible to keep line width lower than 80.
Do you mean source code line? ... 80 is not a strict rule, keep it
readable.
> I can try to split the big function `cal_output_months` this will make
> it more readable, but will introduce a lot of change for no feature.
> Any advice on this ?
Your cal_col_output_months() does not look like any huge monster.
I have added one comment to your commits/cal_column at github.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: cal: column mode
2020-04-14 11:38 ` Karel Zak
@ 2020-04-14 20:18 ` Aurélien Lajoie
2020-04-15 22:04 ` Bruce Dubbs
2020-05-06 13:35 ` Karel Zak
0 siblings, 2 replies; 7+ messages in thread
From: Aurélien Lajoie @ 2020-04-14 20:18 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
On Tue, Apr 14, 2020 at 1:38 PM Karel Zak <kzak@redhat.com> wrote:
>
> On Mon, Apr 13, 2020 at 10:41:34PM +0200, Aurélien Lajoie wrote:
> > As I have announced few days ago, I have started to work on ncal like for cal.
> > I have push a first working version on my github:
> > https://github.com/utix/util-linux/commits/cal_column
>
> Is the option --column the best name? We use "column" pretty often to
> address output in columns or number of columns, etc.
>
> What about --vertical?
sure, no preference for me, ( -v is not used )
How or who decides this kind of stuff (sorry I am a newbie)
> > Does anyone know which locale can have some width issue ?
>
> LC_ALL=ja_JP.utf8 cal
>
> or another with multibyte letters.
ja_JP seems very compact, I think mongolian locale is a good one with month like
Арванхоёрдугаар сар
ja_JP is:
2020
1月 2月 3月
日 月 火 水 木 金 土 日 月 火 水 木 金 土 日 月 火 水 木 金 土
1 2 3 4 1 1 2 3 4 5 6 7
5 6 7 8 9 10 11 2 3 4 5 6 7 8 8 9 10 11 12 13 14
12 13 14 15 16 17 18 9 10 11 12 13 14 15 15 16 17 18 19 20 21
19 20 21 22 23 24 25 16 17 18 19 20 21 22 22 23 24 25 26 27 28
26 27 28 29 30 31 23 24 25 26 27 28 29 29 30 31
4月 5月 6月
日 月 火 水 木 金 土 日 月 火 水 木 金 土 日 月 火 水 木 金 土
1 2 3 4 1 2 1 2 3 4 5 6
5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13
12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20
19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27
26 27 28 29 30 24 25 26 27 28 29 30 28 29 30
31
7月 8月 9月
日 月 火 水 木 金 土 日 月 火 水 木 金 土 日 月 火 水 木 金 土
1 2 3 4 1 1 2 3 4 5
5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12
12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19
19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26
26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30
30 31
10月 11月 12月
日 月 火 水 木 金 土 日 月 火 水 木 金 土 日 月 火 水 木 金 土
1 2 3 1 2 3 4 5 6 7 1 2 3 4 5
4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12
11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19
18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26
25 26 27 28 29 30 31 29 30 27 28 29 30 31
>
> > I have tried to keep the same structure of the code between the column
> > mode and the row mode.
> > It is impossible to keep line width lower than 80.
>
> Do you mean source code line? ... 80 is not a strict rule, keep it
> readable.
Yeap speaking about code line, with tab width set to 8, 80 is quickly reached.
>
> > I can try to split the big function `cal_output_months` this will make
> > it more readable, but will introduce a lot of change for no feature.
> > Any advice on this ?
>
> Your cal_col_output_months() does not look like any huge monster.
>
> I have added one comment to your commits/cal_column at github.
Thanks I will do the modification
>
> Karel
>
>
> --
> Karel Zak <kzak@redhat.com>
> http://karelzak.blogspot.com
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: cal: column mode
2020-04-14 20:18 ` Aurélien Lajoie
@ 2020-04-15 22:04 ` Bruce Dubbs
2020-05-06 13:35 ` Karel Zak
1 sibling, 0 replies; 7+ messages in thread
From: Bruce Dubbs @ 2020-04-15 22:04 UTC (permalink / raw)
To: Aurélien Lajoie, Karel Zak; +Cc: util-linux
On 4/14/20 3:18 PM, Aurélien Lajoie wrote:
> On Tue, Apr 14, 2020 at 1:38 PM Karel Zak <kzak@redhat.com> wrote:
>>
>> On Mon, Apr 13, 2020 at 10:41:34PM +0200, Aurélien Lajoie wrote:
>>> As I have announced few days ago, I have started to work on ncal like for cal.
>>> I have push a first working version on my github:
>>> https://github.com/utix/util-linux/commits/cal_column
>>
>> Is the option --column the best name? We use "column" pretty often to
>> address output in columns or number of columns, etc.
>>
>> What about --vertical?
>
> sure, no preference for me, ( -v is not used )
> How or who decides this kind of stuff (sorry I am a newbie)
>
>>> Does anyone know which locale can have some width issue ?
>>
>> LC_ALL=ja_JP.utf8 cal
>>
>> or another with multibyte letters.
> ja_JP seems very compact, I think mongolian locale is a good one with month like
> Арванхоёрдугаар сар
>
> ja_JP is:
> 2020
>
> 1月 2月 3月
> 日 月 火 水 木 金 土 日 月 火 水 木 金 土 日 月 火 水 木 金 土
> 1 2 3 4 1 1 2 3 4 5 6 7
> 5 6 7 8 9 10 11 2 3 4 5 6 7 8 8 9 10 11 12 13 14
> 12 13 14 15 16 17 18 9 10 11 12 13 14 15 15 16 17 18 19 20 21
> 19 20 21 22 23 24 25 16 17 18 19 20 21 22 22 23 24 25 26 27 28
> 26 27 28 29 30 31 23 24 25 26 27 28 29 29 30 31
>
> 4月 5月 6月
> 日 月 火 水 木 金 土 日 月 火 水 木 金 土 日 月 火 水 木 金 土
> 1 2 3 4 1 2 1 2 3 4 5 6
> 5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13
> 12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20
> 19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27
> 26 27 28 29 30 24 25 26 27 28 29 30 28 29 30
> 31
> 7月 8月 9月
> 日 月 火 水 木 金 土 日 月 火 水 木 金 土 日 月 火 水 木 金 土
> 1 2 3 4 1 1 2 3 4 5
> 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12
> 12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19
> 19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26
> 26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30
> 30 31
> 10月 11月 12月
> 日 月 火 水 木 金 土 日 月 火 水 木 金 土 日 月 火 水 木 金 土
> 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5
> 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12
> 11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19
> 18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26
> 25 26 27 28 29 30 31 29 30 27 28 29 30 31
>
>>
>>> I have tried to keep the same structure of the code between the column
>>> mode and the row mode.
>>> It is impossible to keep line width lower than 80.
>>
>> Do you mean source code line? ... 80 is not a strict rule, keep it
>> readable.
> Yes speaking about code line, with tab width set to 8, 80 is quickly reached.
Don't use a tab width of 8. Research has shown that the most readable
level of code indentation is between 2 and 4 characters. Personally I
use 3.
-- Bruce
>>
>>> I can try to split the big function `cal_output_months` this will make
>>> it more readable, but will introduce a lot of change for no feature.
>>> Any advice on this ?
>>
>> Your cal_col_output_months() does not look like any huge monster.
>>
>> I have added one comment to your commits/cal_column at github.
> Thanks I will do the modification
>>
>> Karel
>>
>>
>> --
>> Karel Zak <kzak@redhat.com>
>> http://karelzak.blogspot.com
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: cal: column mode
2020-04-14 20:18 ` Aurélien Lajoie
2020-04-15 22:04 ` Bruce Dubbs
@ 2020-05-06 13:35 ` Karel Zak
2020-05-06 19:06 ` Aurélien Lajoie
1 sibling, 1 reply; 7+ messages in thread
From: Karel Zak @ 2020-05-06 13:35 UTC (permalink / raw)
To: Aurélien Lajoie; +Cc: util-linux
On Tue, Apr 14, 2020 at 10:18:11PM +0200, Aurélien Lajoie wrote:
> On Tue, Apr 14, 2020 at 1:38 PM Karel Zak <kzak@redhat.com> wrote:
> >
> > On Mon, Apr 13, 2020 at 10:41:34PM +0200, Aurélien Lajoie wrote:
> > > As I have announced few days ago, I have started to work on ncal like for cal.
> > > I have push a first working version on my github:
> > > https://github.com/utix/util-linux/commits/cal_column
Aurélien, what is the current status of this your patch? I'd like to
make v2.36 release at the of the May :-)
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: cal: column mode
2020-05-06 13:35 ` Karel Zak
@ 2020-05-06 19:06 ` Aurélien Lajoie
2020-05-06 21:13 ` Aurélien Lajoie
0 siblings, 1 reply; 7+ messages in thread
From: Aurélien Lajoie @ 2020-05-06 19:06 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
>
> > > On Mon, Apr 13, 2020 at 10:41:34PM +0200, Aurélien Lajoie wrote:
> > > > As I have announced few days ago, I have started to work on ncal like for cal.
> > > > I have push a first working version on my github:
> > > > https://github.com/utix/util-linux/commits/cal_column
>
> Aurélien, what is the current status of this your patch? I'd like to
> make v2.36 release at the of the May :-)
>
>
Hi,
it is finished, doing several test.
I have tested with mn_MN.utf8, fr_FR.utf8 and english.
I have some test to be committed.
I will push all for the end of the week.
My version
May 2020
Su 3 10 17 24 31
Mo 4 11 18 25
Tu 5 12 19 26
We 6 13 20 27
Th 7 14 21 28
Fr 1 8 15 22 29
Sa 2 9 16 23 30
Тавдугаар сар Зургадугаар сар Долдугаар сар
2020 2020 2020
Да 125 132 139 146 153 160 167 174 181 188 195 202 209
Мя 126 133 140 147 154 161 168 175 182 189 196 203 210
Лх 127 134 141 148 155 162 169 176 183 190 197 204 211
Пү 128 135 142 149 156 163 170 177 184 191 198 205 212
Ба 122 129 136 143 150 157 164 171 178 185 192 199 206 213
Бя 123 130 137 144 151 158 165 172 179 186 193 200 207
Ня 124 131 138 145 152 159 166 173 180 187 194 201 208
18 19 20 21 22 23 24 25 26 27 27 28 29 30 31
Наймдугаар сар Есдүгээр сар Аравдугаар
сар
2020 2020 2020
Да 216 223 230 237 244 251 258 265 272 279 286 293 300
Мя 217 224 231 238 245 252 259 266 273 280 287 294 301
Лх 218 225 232 239 246 253 260 267 274 281 288 295 302
Пү 219 226 233 240 247 254 261 268 275 282 289 296 303
Ба 220 227 234 241 248 255 262 269 276 283 290 297 304
Бя 214 221 228 235 242 249 256 263 270 277 284 291 298 305
Ня 215 222 229 236 243 250 257 264 271 278 285 292 299
31 32 33 34 35 36 36 37 38 39 40 40 41 42 43 44
Арван нэгдүгээр сар Арван хоёрдугаар сар Нэгдүгээр
сар
2020 2020 2021
Да 307 314 321 328 335 342 349 356 363 4 11 18 25
Мя 308 315 322 329 336 343 350 357 364 5 12 19 26
Лх 309 316 323 330 337 344 351 358 365 6 13 20 27
Пү 310 317 324 331 338 345 352 359 366 7 14 21 28
Ба 311 318 325 332 339 346 353 360 1 8 15 22 29
Бя 312 319 326 333 340 347 354 361 2 9 16 23 30
Ня 306 313 320 327 334 341 348 355 362 3 10 17 24 31
44 45 46 47 48 49 49 50 51 52 53 53 1 2 3 4
Хоёрдугаар сар Гуравдугаар сар Дөрөвдүгээр
сар
2021 2021 2021
Да 32 39 46 53 60 67 74 81 88 95 102 109 116
Мя 33 40 47 54 61 68 75 82 89 96 103 110 117
Лх 34 41 48 55 62 69 76 83 90 97 104 111 118
Пү 35 42 49 56 63 70 77 84 91 98 105 112 119
Ба 36 43 50 57 64 71 78 85 92 99 106 113 120
Бя 37 44 51 58 65 72 79 86 93 100 107 114
Ня 38 45 52 59 66 73 80 87 94 101 108 115
5 6 7 8 9 10 11 12 13 13 14 15 16 17
ncal
Тавдугаар сар 2020 Зургадугаар сар 2020 Долдугаар сар 2020
Да 125 132 139 146 153 160 167 174 181 188 195 202 209
Мя 126 133 140 147 154 161 168 175 182 189 196 203 210
Лх 127 134 141 148 155 162 169 176 183 190 197 204 211
Пү 128 135 142 149 156 163 170 177 184 191 198 205 212
Ба 122 129 136 143 150 157 164 171 178 185 192 199 206 213
Бя 123 130 137 144 151 158 165 172 179 186 193 200 207
Ня 124 131 138 145 152 159 166 173 180 187 194 201 208
17 18 19 20 21 22 23 24 25 26 26 27 28 29 30
Наймдугаар сар 2020 Есдүгээр сар 2020 Аравдугаар сар 2020
Да 216 223 230 237 244 251 258 265 272 279 286 293 300
Мя 217 224 231 238 245 252 259 266 273 280 287 294 301
Лх 218 225 232 239 246 253 260 267 274 281 288 295 302
Пү 219 226 233 240 247 254 261 268 275 282 289 296 303
Ба 220 227 234 241 248 255 262 269 276 283 290 297 304
Бя 214 221 228 235 242 249 256 263 270 277 284 291 298 305
Ня 215 222 229 236 243 250 257 264 271 278 285 292 299
30 31 32 33 34 35 35 36 37 38 39 39 40 41 42 43
Арван нэгдүгээр сар 2020Арван хоёрдугаар сар 2020Нэгдүгээр сар 2021
Да 307 314 321 328 335 342 349 356 363 4 11 18 25
Мя 308 315 322 329 336 343 350 357 364 5 12 19 26
Лх 309 316 323 330 337 344 351 358 365 6 13 20 27
Пү 310 317 324 331 338 345 352 359 366 7 14 21 28
Ба 311 318 325 332 339 346 353 360 1 8 15 22 29
Бя 312 319 326 333 340 347 354 361 2 9 16 23 30
Ня 306 313 320 327 334 341 348 355 362 3 10 17 24 31
43 44 45 46 47 48 48 49 50 51 52 52 1 2 3 4
Хоёрдугаар сар 2021 Гуравдугаар сар 2021 Дөрөвдүгээр сар 2021
Да 32 39 46 53 60 67 74 81 88 95 102 109 116
Мя 33 40 47 54 61 68 75 82 89 96 103 110 117
Лх 34 41 48 55 62 69 76 83 90 97 104 111 118
Пү 35 42 49 56 63 70 77 84 91 98 105 112 119
Ба 36 43 50 57 64 71 78 85 92 99 106 113 120
Бя 37 44 51 58 65 72 79 86 93 100 107 114
Ня 38 45 52 59 66 73 80 87 94 101 108 115
5 6 7 8 9 10 11 12 13 13 14 15 16 17
>
> Karel
>
> --
> Karel Zak <kzak@redhat.com>
> http://karelzak.blogspot.com
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: cal: column mode
2020-05-06 19:06 ` Aurélien Lajoie
@ 2020-05-06 21:13 ` Aurélien Lajoie
0 siblings, 0 replies; 7+ messages in thread
From: Aurélien Lajoie @ 2020-05-06 21:13 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
On Wed, May 6, 2020 at 9:06 PM Aurélien Lajoie <orel@melix.net> wrote:
>
> >
> > > > On Mon, Apr 13, 2020 at 10:41:34PM +0200, Aurélien Lajoie wrote:
> > > > > As I have announced few days ago, I have started to work on ncal like for cal.
> > > > > I have push a first working version on my github:
> > > > > https://github.com/utix/util-linux/commits/cal_column
> >
> > Aurélien, what is the current status of this your patch? I'd like to
> > make v2.36 release at the of the May :-)
The pull request is done
https://github.com/karelzak/util-linux/pull/1032
Try to be close to ncal
Major differences:
- On Julian calendar cal is using 3 letters day, keep this in vertical mode
- ncal puts 4 months per line, keep 3 for cal as in classic mode
- ncal uses only 1 space between month, cal 2 as in classic mode
- ncal and cal are putting trailing spaces, but not the same
What do you think about removing the trailing spaces for cal output ?
This is not relative to the vertical mode
Aurelien
> >
> > Karel
> >
> > --
> > Karel Zak <kzak@redhat.com>
> > http://karelzak.blogspot.com
> >
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-05-06 21:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-13 20:41 cal: column mode Aurélien Lajoie
2020-04-14 11:38 ` Karel Zak
2020-04-14 20:18 ` Aurélien Lajoie
2020-04-15 22:04 ` Bruce Dubbs
2020-05-06 13:35 ` Karel Zak
2020-05-06 19:06 ` Aurélien Lajoie
2020-05-06 21:13 ` Aurélien Lajoie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).