lorid

convert chordpro to pdf
git clone git://git.relim.de/lorid.git
Log | Files | Refs | README | LICENSE

commit ef83f15d6f363c00ccb6e35048dde7c7154ab49b
parent 2b7aede1b996d407008e432da94aaf535b79ad5a
Author: nibo <nibo@relim.de>
Date:   Mon, 30 Dec 2024 12:27:26 +0100

Improve man page

Diffstat:
Mlorid.1 | 29+++++++++++++++++++++++------
Mlorid.c | 8++++++--
Mout_pdf.c | 1-
3 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/lorid.1 b/lorid.1 @@ -3,22 +3,39 @@ lorid \- convert chordpro to pdf .SH SYNOPSIS .B lorid -[-p] [-c \fI\,filepath\/\fR] [-v] [-h] [-o \fI\,path\/\fR] [\fI\,filepath\/\fR] ... +[-p] [-c \fI\,FILE\/\fR] [-v] [-h] [-o \fI\,path\/\fR] [\fI\,FILE\/\fR ...] .SH DESCRIPTION .PP .B lorid -reads text from -.I filepath -and if it wasn't provided then from stdin. +reads text from one or more \fI\,FILE\/\fR's +and if no +.I FILE +was provided then from stdin. The text will be parsed according to the chordpro specification and then converted to pdf. These two steps can be altered by changing the configuration file. .TP \fB\,-o\/\fR, \fB\,--output\/\fR -Specify an output folder or file. If you specify a folder -then the generated pdf file will be saved in that folder. +Specify an output file or folder. + If you specify a file the generated pdf file will be saved as that file. + +If you specify a folder the generated pdf file will be +saved in that folder with a filename also generated by +lorid. + +If lorid finds exactly one song and you provided a file to parse +from then lorid will replace the file extension with '.pdf' and +use that as output filename. + +If lorid finds exactly one song but you didn't provide a file +to parse from then lorid will generate a filename based on the +song title in kebab case. + +If lorid finds more than one song it will use the +filename 'collection-of-songs.pdf'. + .TP \fB\,-p\/\fR, \fB\,--print-default-config\/\fR Print the default configuration as TOML. diff --git a/lorid.c b/lorid.c @@ -46,8 +46,7 @@ main(int argc, char *argv[]) printf(VERSION"\n"); return 0; case 'h': - printf("Help.\n"); - return 0; + return system("man lorid"); } } struct Config *config = config_load(config_filepath); @@ -58,6 +57,11 @@ main(int argc, char *argv[]) free(config_filepath); if (argc == optind) { fp = stdin; + all_songs = cho_songs_parse(fp, NULL, config); + if (!all_songs) { + LOG_DEBUG("cho_songs_parse failed."); + return 1; + } } else if (argc == optind+1) { fp = fopen(argv[argc-1], "r"); if (!fp) { diff --git a/out_pdf.c b/out_pdf.c @@ -1999,7 +1999,6 @@ pdf_content_create( for (int p = ctx.text-1; prev_y == (*texts)[p]->y; p--) { (*texts)[p]->y = ctx.y; tmp = erealloc(tmp, (tm+1) * sizeof(struct PDFText *)); - printf("s '%s'\n", (*texts)[p]->text); tmp[tm] = (*texts)[p]; tm++; *texts = erealloc(*texts, (--ctx.text) * sizeof(struct PDFText *));