~emersion/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH gamja] commands: Add LIST command

Cara Salter <cara@devcara.com>
Details
Message ID
<20211116154438.235815-1-cara@devcara.com>
DKIM signature
pass
Download raw message
Patch: +12 -0
Signed-off-by: Cara Salter <cara@devcara.com>
---
This adds the ability to use /list directly, without having to use /quote

 commands.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/commands.js b/commands.js
index 7f13792..fa06fcf 100644
--- a/commands.js
+++ b/commands.js
@@ -411,4 +411,16 @@ export default {
			markServerBufferUnread(app);
		},
	},
	"list": {
		usage: "[filter]",
		description: "Retrieve a list of channels from a network",
		execute: (app, args) => {
			let filter = args[0];
			if filter {
				getActiveClient(app).send({ command: "LIST", params: [filter] });
			} else {
				getActiveClient(app).send({ command: "LIST", params: [] });
			}
		},
	},
};
-- 
2.33.1
Details
Message ID
<OfFVDOEwAEXcakh2A1QHhw7J9ejHXmRGYhQjrMEgvklTz1Pz_FbLgrCYx13Ala7JD6PVMlr5X8pbZJSrWEUK_OzMu_fgcZvK0Q2cqB1iG-0=@emersion.fr>
In-Reply-To
<20211116154438.235815-1-cara@devcara.com> (view parent)
DKIM signature
pass
Download raw message
Thanks for sending a patch! A few comments below.

On Tuesday, November 16th, 2021 at 16:44, Cara Salter <cara@devcara.com> wrote:

> +	"list": {
> +		usage: "[filter]",
> +		description: "Retrieve a list of channels from a network",
> +		execute: (app, args) => {
> +			let filter = args[0];
> +			if filter {

This condition is missing parentheses. Please test your patches!

> +				getActiveClient(app).send({ command: "LIST", params: [filter] });
> +			} else {
> +				getActiveClient(app).send({ command: "LIST", params: [] });
> +			}

I think the whole logic can be simplified with:

    { command: "LIST", params: args }

Then no need for the condition.
Cara Salter <cara@devcara.com>
Details
Message ID
<39d0cb29-ab45-8f06-918f-a89a8c9ef531@devcara.com>
In-Reply-To
<OfFVDOEwAEXcakh2A1QHhw7J9ejHXmRGYhQjrMEgvklTz1Pz_FbLgrCYx13Ala7JD6PVMlr5X8pbZJSrWEUK_OzMu_fgcZvK0Q2cqB1iG-0=@emersion.fr> (view parent)
DKIM signature
pass
Download raw message
Thanks for the feedback!

On 11/16/21 11:35, Simon Ser wrote:
> Thanks for sending a patch! A few comments below.
>
> On Tuesday, November 16th, 2021 at 16:44, Cara Salter <cara@devcara.com> wrote:
>
>> +	"list": {
>> +		usage: "[filter]",
>> +		description: "Retrieve a list of channels from a network",
>> +		execute: (app, args) => {
>> +			let filter = args[0];
>> +			if filter {
> This condition is missing parentheses. Please test your patches!
Thanks for pointing this out -- I committed this version, found the 
error with parentheses, then forgot to amend :p, the new patch is coming 
shortly
>
>> +				getActiveClient(app).send({ command: "LIST", params: [filter] });
>> +			} else {
>> +				getActiveClient(app).send({ command: "LIST", params: [] });
>> +			}
> I think the whole logic can be simplified with:
>
>      { command: "LIST", params: args }
>
> Then no need for the condition.

I wanted to make sure that it would work and I was unfamiliar with the 
way that the command system worked. Will fix in next version


Thank you!
Reply to thread Export thread (mbox)