Skip to content

Commit c6680cb

Browse files
committed
cleanup
1 parent f6bb18b commit c6680cb

File tree

3 files changed

+7
-72
lines changed

3 files changed

+7
-72
lines changed

src/cli.c

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ void editor_cli_print_usage(void) {
1818
printf("\nOptions:\n");
1919
printf(" -h, --help Show this help message\n");
2020
printf(" -v, --version Show version information\n");
21-
printf(" -sf PATH Use built-in synth with soundfont (.sf2)\n");
22-
printf(" -cs PATH Use Csound synthesis with .csd file\n");
2321
printf(" --line-numbers Show line numbers\n");
2422
printf(" --word-wrap Enable word wrap\n");
2523
printf(" --json-rpc Run in JSON-RPC mode (stdin/stdout)\n");
@@ -32,17 +30,13 @@ void editor_cli_print_usage(void) {
3230
printf(" --web-port N Web server port (default: 8080)\n");
3331
printf(" --web-root PATH Directory containing web UI files\n");
3432
#endif
35-
printf("\nInteractive mode (default):\n");
36-
printf(" " LOKI_NAME " <file.alda> Open file in editor\n");
37-
printf(" " LOKI_NAME " -sf gm.sf2 song.alda Open with TinySoundFont synth\n");
38-
printf(" " LOKI_NAME " -cs inst.csd song.alda Open with Csound synthesis\n");
33+
printf("\nExamples:\n");
34+
printf(" " LOKI_NAME " file.txt Open file in editor\n");
35+
printf(" " LOKI_NAME " --json-rpc Run in JSON-RPC mode\n");
3936
#ifdef LOKI_WEB_HOST
40-
printf(" " LOKI_NAME " --web song.alda Open in browser at localhost:8080\n");
37+
printf(" " LOKI_NAME " --web file.txt Open in browser at localhost:8080\n");
4138
#endif
4239
printf("\nKeybindings:\n");
43-
printf(" Ctrl-E Play current part or selection\n");
44-
printf(" Ctrl-P Play entire file\n");
45-
printf(" Ctrl-G Stop playback\n");
4640
printf(" Ctrl-S Save file\n");
4741
printf(" Ctrl-Q Quit\n");
4842
printf(" Ctrl-F Find\n");
@@ -70,26 +64,6 @@ int editor_cli_parse(int argc, char **argv, EditorCliArgs *args) {
7064
return 0;
7165
}
7266

73-
/* Soundfont option */
74-
if (strcmp(arg, "-sf") == 0) {
75-
if (i + 1 >= argc) {
76-
fprintf(stderr, "Error: -sf requires a path argument\n");
77-
return -1;
78-
}
79-
args->soundfont_path = argv[++i];
80-
continue;
81-
}
82-
83-
/* Csound option */
84-
if (strcmp(arg, "-cs") == 0) {
85-
if (i + 1 >= argc) {
86-
fprintf(stderr, "Error: -cs requires a path argument\n");
87-
return -1;
88-
}
89-
args->csound_path = argv[++i];
90-
continue;
91-
}
92-
9367
/* Line numbers option */
9468
if (strcmp(arg, "--line-numbers") == 0) {
9569
args->line_numbers = 1;

src/cli.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ extern "C" {
2020
*/
2121
typedef struct {
2222
const char *filename; /* File to open (NULL if none) */
23-
const char *soundfont_path; /* Path to soundfont for TinySoundFont (-sf) */
24-
const char *csound_path; /* Path to CSD file for Csound (-cs) */
2523
const char *web_root; /* Web UI directory for web mode (--web-root) */
2624
int show_help; /* User requested help (-h, --help) */
2725
int show_version; /* User requested version (-v, --version) */

src/editor.c

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,9 @@ static void print_usage(void) {
253253
printf("\nOptions:\n");
254254
printf(" -h, --help Show this help message\n");
255255
printf(" -v, --version Show version information\n");
256-
printf(" -sf PATH Use built-in synth with soundfont (.sf2)\n");
257-
printf(" -cs PATH Use Csound synthesis with .csd file\n");
258-
printf("\nInteractive mode (default):\n");
259-
printf(" " LOKI_NAME " <file> Open file in editor\n");
260-
printf(" " LOKI_NAME " -sf gm.sf2 song.txt Open file with TinySoundFont (not available)\n");
261-
printf(" " LOKI_NAME " -cs inst.csd song.txt Open file with Csound (not available)\n");
256+
printf("\nExamples:\n");
257+
printf(" " LOKI_NAME " file.txt Open file in editor\n");
262258
printf("\nKeybindings:\n");
263-
printf(" Ctrl-E Play current part or selection\n");
264-
printf(" Ctrl-P Play entire file\n");
265-
printf(" Ctrl-G Stop playback\n");
266259
printf(" Ctrl-S Save file\n");
267260
printf(" Ctrl-Q Quit\n");
268261
printf(" Ctrl-F Find\n");
@@ -289,8 +282,6 @@ int loki_editor_main(int argc, char **argv) {
289282

290283
/* Parse command-line arguments */
291284
const char *filename = NULL;
292-
const char *soundfont_path = NULL;
293-
const char *csound_path = NULL;
294285

295286
for (int i = 1; i < argc; i++) {
296287
if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) {
@@ -301,14 +292,6 @@ int loki_editor_main(int argc, char **argv) {
301292
printf(LOKI_NAME " %s\n", LOKI_VERSION);
302293
exit(0);
303294
}
304-
if (strcmp(argv[i], "-sf") == 0 && i + 1 < argc) {
305-
soundfont_path = argv[++i];
306-
continue;
307-
}
308-
if (strcmp(argv[i], "-cs") == 0 && i + 1 < argc) {
309-
csound_path = argv[++i];
310-
continue;
311-
}
312295
if (argv[i][0] == '-') {
313296
fprintf(stderr, "Error: Unknown option: %s\n", argv[i]);
314297
print_usage();
@@ -406,27 +389,7 @@ int loki_editor_main(int argc, char **argv) {
406389
if (ret == 0) {
407390
const LokiLangOps *lang = loki_lang_for_file(ctx->model.filename);
408391
if (lang) {
409-
/* Configure audio backend if requested via CLI */
410-
int backend_ret = loki_lang_configure_backend(ctx, soundfont_path, csound_path);
411-
if (backend_ret == 0) {
412-
/* Backend configured successfully */
413-
if (csound_path) {
414-
editor_set_status_msg(ctx, "%s: Using Csound (%s)", lang->name, csound_path);
415-
} else if (soundfont_path) {
416-
editor_set_status_msg(ctx, "%s: Using TinySoundFont (%s)", lang->name, soundfont_path);
417-
}
418-
} else if (backend_ret == -1) {
419-
/* Backend requested but failed */
420-
const char *err = loki_lang_get_error(ctx);
421-
if (csound_path) {
422-
editor_set_status_msg(ctx, "Failed to load CSD: %s", err ? err : csound_path);
423-
} else if (soundfont_path) {
424-
editor_set_status_msg(ctx, "Failed to load soundfont: %s", err ? err : soundfont_path);
425-
}
426-
} else {
427-
/* No backend requested - show default message */
428-
editor_set_status_msg(ctx, "%s: Ctrl-E eval, Ctrl-G stop", lang->name);
429-
}
392+
editor_set_status_msg(ctx, "%s mode", lang->name);
430393
}
431394
} else if (ret == -1) {
432395
const char *err = loki_lang_get_error(ctx);

0 commit comments

Comments
 (0)