CLI interface to medialist (fossil mirror)
Revision | 74585568b0ee7d76a88406ce67238ec3a39a9e1b (tree) |
---|---|
Zeit | 2023-04-04 15:40:02 |
Autor | mio <stigma@disr...> |
Commiter | mio |
Finish updating medialist info document for version 0.4
FossilOrigin-Name: f3ae10816106fa4fc5833a092293ea7065f4a7bf7eb31dfd22356f800cca4d78
@@ -1,7 +1,7 @@ | ||
1 | 1 | \input texinfo @c -*-texinfo-*- |
2 | 2 | |
3 | 3 | @set VERSION 0.4 |
4 | -@set UPDATED 2022-03-16 | |
4 | +@set UPDATED 2022-04-04 | |
5 | 5 | |
6 | 6 | @settitle MediaList @value{VERSION} |
7 | 7 | @syncodeindex pg cp |
@@ -39,7 +39,7 @@ information, visit @uref{http://creativecommons.org/publicdomain/zero/1.0/}. | ||
39 | 39 | @contents |
40 | 40 | |
41 | 41 | @node Top |
42 | -@top MediaList | |
42 | +@top Top | |
43 | 43 | |
44 | 44 | This manual is for MediaList (version @value{VERSION}, @value{UPDATED}). |
45 | 45 |
@@ -84,6 +84,38 @@ Some programs (e.g. the | ||
84 | 84 | @uref{https://yume-neru.neocities.org/p/medialist.html, medialist suite of programs}) |
85 | 85 | use these comments as a way of providing per-file configuration. |
86 | 86 | |
87 | +@node Constants | |
88 | +@chapter Constants | |
89 | + | |
90 | +There are only a couple of constants present in MediaList. | |
91 | + | |
92 | +@table @code | |
93 | +@item enum string MediaListVersion | |
94 | +@pindex enum MediaListVersion | |
95 | + | |
96 | +This string represents the current version of MediaList, it may also | |
97 | +contains a ``-dev'' suffix to indicate that you're running a development | |
98 | +version which may have some known bugs. The format is Major.Minor.Patch. | |
99 | + | |
100 | +A ``Major'' version change represents the removal or modification of an | |
101 | +existing API. The ``Patch'' version is used only for compile-time fixes. | |
102 | +The ``Minor'' version represents all other changes. | |
103 | + | |
104 | +@item enum int[3] MediaListVersionA | |
105 | +@pindex enum MediaListVersionA | |
106 | + | |
107 | +This static array represents the version of MediaList you're compiling | |
108 | +against. Unlike the string version, this doesn't have a method for | |
109 | +determining a development version. The format is still Major.Minor.Patch. | |
110 | + | |
111 | +@end table | |
112 | + | |
113 | +@cartouche | |
114 | +@b{Note}: MediaList hasn't reached a ``1.0.0'' version yet, each new | |
115 | +release is only incrementing the ``Minor'' version. These ``pre-Major'' | |
116 | +versions can still contain modifications to (or the removal of) APIs. | |
117 | +@end cartouche | |
118 | + | |
87 | 119 | @node Data Types |
88 | 120 | @chapter Data Types |
89 | 121 |
@@ -391,38 +423,52 @@ code. | ||
391 | 423 | |
392 | 424 | @table @code |
393 | 425 | @item MediaList* ml_open_list(string filePath) |
426 | +@item MediaList* ml_open_list(string filePath, out MLError error) nothrow | |
394 | 427 | @pindex ml_open_list |
395 | 428 | |
396 | 429 | This function will allocate the memory for a @code{MediaList} structure, |
397 | 430 | returning @code{null} if the allocation fails. |
398 | 431 | |
399 | -@item void ml_free_list(MediaList* list) | |
432 | +If the underlying file for the list doesn't exist (i.e. a new list is being | |
433 | +created), then the file will be created with the default headers. | |
434 | + | |
435 | +The nothrow version will return provide a @code{MLError} in the event of | |
436 | +an error when creating the new file, otherwise it will be equal to | |
437 | +@code{MLError.success}. | |
438 | + | |
439 | +@item void ml_free_list(MediaList* list) nothrow | |
400 | 440 | @pindex ml_free_list |
401 | 441 | |
402 | -This function will free the allocated memory for a @code{MediaList} structure. | |
442 | +This function will free the allocated memory for a @code{MediaList} | |
443 | +structure created by @code{ml_open_list}. | |
403 | 444 | |
404 | -@item MediaListHeader[] ml_fetch_headers(MediaList* list, MLError* error = null) | |
445 | +@item MediaListHeader[] ml_fetch_headers(MediaList* list) | |
446 | +@item MediaListHeader[] ml_fetch_headers(MediaList* list, out MLError error) nothrow | |
405 | 447 | @pindex ml_fetch_headers |
406 | 448 | |
407 | 449 | This function will fetch all of the headers from the list's mTSV file. An |
408 | 450 | optional @code{error} parameter is provided for error handling. |
409 | 451 | |
410 | -@item MediaListItem ml_fetch_item(MediaList* list, size_t id, MLError* error = null) | |
452 | +@item MediaListItem ml_fetch_item(MediaList* list, size_t id) | |
453 | +@item MediaListItem ml_fetch_item(MediaList* list, size_t id, out MLError error) nothrow | |
411 | 454 | @pindex ml_fetch_item |
412 | 455 | |
413 | 456 | Fetch a single item from the list. |
414 | 457 | |
415 | -@item MediaListItem[] ml_fetch_items(MediaList* list, MLError* error, size_t[] ids...) | |
458 | +@item MediaListItem[] ml_fetch_items(MediaList* list, size_t[] ids...) | |
459 | +@item MediaListItem[] ml_fetch_items(MediaList* list, out MLError err, size_t[] ids ...) nothrow | |
416 | 460 | @pindex ml_fetch_items |
417 | 461 | |
418 | 462 | Fetch multiple items from a list. |
419 | 463 | |
420 | -@item MediaListItem[] ml_fetch_all(MediaList* list, MLError* error = null) | |
464 | +@item MediaListItem[] ml_fetch_all(MediaList* list) | |
465 | +@item MediaListItem[] ml_fetch_all(MediaList* list, out MLError error) nothrow | |
421 | 466 | @pindex ml_fetch_all |
422 | 467 | |
423 | 468 | Fetch and return all of the items in a list. |
424 | 469 | |
425 | -@item MLError ml_send_command(MediaList* list, MLCommand command, string[] args) | |
470 | +@item void ml_send_command(MediaList* list, MLCommand command, string[] args) | |
471 | +@item void ml_send_command(MediaList* list, MLCommand command, string[] args, out MLError error) nothrow | |
426 | 472 | @pindex ml_send_command |
427 | 473 | |
428 | 474 | Send a command to the list. This is how all of the editing of the list is done. |
@@ -484,8 +530,8 @@ int main(string[] args) | ||
484 | 530 | ml_send_command(list, MLCommand.add, ["Item 2", "10/100"], err); |
485 | 531 | if (MLError.success != err) print_error(err); |
486 | 532 | |
487 | - ml_send_command(list, MLCommand.add, ["Item 3", null, "PLAN-TO-WATCH"], | |
488 | - err); | |
533 | + ml_send_command(list, MLCommand.add, | |
534 | + ["Item 3", null, "PLAN-TO-WATCH"], err); | |
489 | 535 | if (MLError.success != err) print_error(err); |
490 | 536 | |
491 | 537 | ml_send_command(list, MLCommand.add, ["Item 4", "10/10", "COMPLETE"], |
@@ -504,12 +550,12 @@ int main(string[] args) | ||
504 | 550 | if (MLError.success != err) print_error(err); |
505 | 551 | |
506 | 552 | ml_send_command(list, MLCommand.update, |
507 | - ["4", "start_date::2021-11-25", "end_date::2022-02-13"], | |
508 | - err); | |
553 | + ["4","start_date::2021-11-25","end_date::2022-02-13"], | |
554 | + err); | |
509 | 555 | if (MLError.success != err) print_error(err); |
510 | 556 | |
511 | - ml_send_command(list, MLCommand.update, ["3", "title::The Third Item"], | |
512 | - err); | |
557 | + ml_send_command(list, MLCommand.update, | |
558 | + ["3", "title::The Third Item"], err); | |
513 | 559 | if (MLError.success != err) print_error(err); |
514 | 560 | |
515 | 561 | /* Fetch an item and write the details out. */ |