Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When listing language options in the spec, use "x, y, or z" format #1745

Merged
merged 1 commit into from
Dec 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/studio/screens/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,23 @@ static char* replaceHelpTokens(const char* text)
char langnames[10240] = {0};
char langextensions[10240] = {0};
char langnamespipe[10240] = {0};

FOR_EACH_LANG(ln)
bool isLast = *(conf+1) == NULL;
bool isSecondToLast = *(conf+2) == NULL;

strcat(langnames, ln->name);
strcat(langnames, " ");
if (!isLast)
strcat(langnames, ", ");
if (isSecondToLast)
strcat(langnames, "or ");

strcat(langextensions, ln->fileExtension);
strcat(langextensions, " ");

strcat(langnamespipe, ln->name);
strcat(langnamespipe, "|");
if (!isLast)
strcat(langnamespipe, "|");
FOR_EACH_LANG_END


Expand Down Expand Up @@ -2540,7 +2548,7 @@ static const char HelpUsage[] = "help [<text>"
macro("new", \
NULL, \
"creates a new `Hello World` cartridge.", \
"new [$LANG_NAMES_PIPE$...]", \
"new [$LANG_NAMES_PIPE$]", \
onNewCommand) \
\
macro("load", \
Expand Down