Skip to content

Enhanced version of Help command#93

Merged
breakintoprogram merged 7 commits intobreakintoprogram:mainfrom
stevesims:commmands-ss
Nov 11, 2023
Merged

Enhanced version of Help command#93
breakintoprogram merged 7 commits intobreakintoprogram:mainfrom
stevesims:commmands-ss

Conversation

@stevesims
Copy link
Copy Markdown
Contributor

Builds on @leighbb's very handy PR #60

My enhancements to it are to change how help is generated. This is mostly about splitting out arguments and aliases from the help text itself.

There's also one or two minor typos fixed in help text, and some minor modifications in some of the help text messaging.

Leigh Brown and others added 7 commits October 16, 2023 18:42
Add strings.c with strcasecmp()
Move fs variable from main.c to src/mos.c
Create new mos_mount() function in src/mos.c
Call mos_mount() from main() instead of directly calling f_mount
Add mos_cmdMOUNT() that calls mos_mount() in src/mos.c
Add additional commands to list of commands in HELP text.
@breakintoprogram breakintoprogram added the enhancement New feature or request label Nov 5, 2023
@breakintoprogram breakintoprogram self-assigned this Nov 11, 2023
@breakintoprogram
Copy link
Copy Markdown
Owner

There's a bug if you use it in BBC BASIC - get gibberish at end of error message if an unknown command is found. Think I know what it is - will fix. Will also add help text for the new SET CONSOLE command for Quark.

@stevesims
Copy link
Copy Markdown
Contributor Author

cool cool.

I have this merged into the Console8 codebase a little while ago, so it's been getting a bit of use... there's a bug that @lennart-benschop spotted there with HELP with no argument not working - it reports an error, possibly the same problem you've observed. AgonPlatform/agon-mos#25

I did try to have a look to understand why that bug was happening, but I couldn't work out why - the code looked fine to me. 🤷 Hopefully you'll have more luck @breakintoprogram 😁

@breakintoprogram
Copy link
Copy Markdown
Owner

I have this merged into the Console8 codebase a little while ago, so it's been getting a bit of use... there's a bug that @lennart-benschop spotted there with HELP with no argument not working - it reports an error, possibly the same problem you've observed. AgonConsole8/agon-mos#25

I did try to have a look to understand why that bug was happening, but I couldn't work out why - the code looked fine to me. 🤷 Hopefully you'll have more luck @breakintoprogram 😁

Yes, it was returning -1 if it failed, an invalid error code. I've set this to 20 which is (in mos_errors) Invalid Command. It'll output the error automatically. I'll add some belts and braces into the error output code so that doesn't happen.

int mos_cmdHELP(char *ptr) {
	int i;
	int found = 0;
	char *cmd;

	mos_parseString(NULL, &cmd);
	if (cmd != NULL && strcasecmp(cmd, "all") == 0)
		cmd = NULL;

	for (i = 0; i < sizeof(mosCommands) / sizeof(mosCommands[0]); ++i) {
		if (cmd == NULL) 
			printCommandInfo(&mosCommands[i]);
		else
			if (strcasecmp(cmd, mosCommands[i].name) == 0) {
				printCommandInfo(&mosCommands[i]);
				found = 1;
			}
	}

	if (cmd != NULL && !found) {
		return 20;
	}
	return 0;

@breakintoprogram breakintoprogram merged commit cd43ea1 into breakintoprogram:main Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants