ARTS37 / SerialMenuCmd

This Arduino library constitutes a basic Command Line Interface
MIT License
8 stars 2 forks source link

suggestion! #1

Open ElectroLund opened 1 year ago

ElectroLund commented 1 year ago

There are times when it would be handy to reprint the menu description. For instance:

tMenuCmdTxt txt_cli_power[] = "m - motor power"; tMenuCmdTxt txt_cli_forward[] = "f - forward"; tMenuCmdTxt txt_cli_backward[] = "b - backward"; tMenuCmdTxt txt_cli_full[] = "1 - full speed"; tMenuCmdTxt txt_cli_half[] = "2 - half speed"; Now, it strikes me that there is inherent duplication of effort when we put inline the character to be used for each menu item. "m - motor power"

So that leads me to the recommendation. Why not just pull the character out of the list array and print that automatically in the ShowMenu() call?

So then, tMenuCmdTxt declaration would instead look like this:

tMenuCmdTxt txt_cli_power[] = "motor power";

And then the stMenuCmd list looks like this:

stMenuCmd cli_list[] = { {txt_cli_power, 'm', cmd_power},

And that character for the command would then get auto-printed.

ARTS37 commented 1 year ago

hi rob I'm currently on vacation, so far from a keyboard (just the right to my phone 😭). I think I understand what you are suggesting to me. as soon as I get back to business, I get to work!

P.S. I'm trying my hand at humor but if my answer seems strange to you, please excuse me for being an incorrigible Frenchman.

Le lun. 20 févr. 2023, 19:45, Rob @.***> a écrit :

There are times when it would be handy to reprint the menu description. For instance:

tMenuCmdTxt txt_cli_power[] = "m - motor power"; tMenuCmdTxt txt_cli_forward[] = "f - forward"; tMenuCmdTxt txt_cli_backward[] = "b - backward"; tMenuCmdTxt txt_cli_full[] = "1 - full speed"; tMenuCmdTxt txt_cli_half[] = "2 - half speed";

Now, it strikes me that there is inherent duplication of effort when we put inline the character to be used for each menu item. "m - motor power"

So that leads me to the recommendation. Why not just pull the character out of the list array and print that automatically in the ShowMenu() call?

stMenuCmd cli_list[] = { {txt_cli_power, 'm', cmd_power}, {txt_cli_forward, 'f', cmd_forward}, {txt_cli_backward, 'b', cmd_backward}, {txt_cli_full, '1', cmd_full}, {txt_cli_half, '2', cmd_half},

— Reply to this email directly, view it on GitHub https://github.com/ARTS37/SerialMenuCmd/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUBWICXBNBTVIXBXDJ3GDJLWYO3S5ANCNFSM6AAAAAAVCGCNEY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ElectroLund commented 1 year ago

You are awesome! And bilingual, so much better than me.

Enjoy your vacation, stay safe.

On Tue, Feb 21, 2023 at 2:56 PM Armand ROLLAND @.***> wrote:

hi rob I'm currently on vacation, so far from a keyboard (just the right to my phone 😭). I think I understand what you are suggesting to me. as soon as I get back to business, I get to work!

P.S. I'm trying my hand at humor but if my answer seems strange to you, please excuse me for being an incorrigible Frenchman.

Le lun. 20 févr. 2023, 19:45, Rob @.***> a écrit :

There are times when it would be handy to reprint the menu description. For instance:

tMenuCmdTxt txt_cli_power[] = "m - motor power"; tMenuCmdTxt txt_cli_forward[] = "f - forward"; tMenuCmdTxt txt_cli_backward[] = "b - backward"; tMenuCmdTxt txt_cli_full[] = "1 - full speed"; tMenuCmdTxt txt_cli_half[] = "2 - half speed";

Now, it strikes me that there is inherent duplication of effort when we put inline the character to be used for each menu item. "m - motor power"

So that leads me to the recommendation. Why not just pull the character out of the list array and print that automatically in the ShowMenu() call?

stMenuCmd cli_list[] = { {txt_cli_power, 'm', cmd_power}, {txt_cli_forward, 'f', cmd_forward}, {txt_cli_backward, 'b', cmd_backward}, {txt_cli_full, '1', cmd_full}, {txt_cli_half, '2', cmd_half},

— Reply to this email directly, view it on GitHub https://github.com/ARTS37/SerialMenuCmd/issues/1, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AUBWICXBNBTVIXBXDJ3GDJLWYO3S5ANCNFSM6AAAAAAVCGCNEY

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ARTS37/SerialMenuCmd/issues/1#issuecomment-1439141176, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKZXSJAX5LRDCMJFESMWDWYU2YPANCNFSM6AAAAAAVCGCNEY . You are receiving this because you authored the thread.Message ID: @.***>

ARTS37 commented 1 year ago

Hi Rob, I'm back !!! I have sent you the modified code as an attachment. Now, you no longer have to specify the key in the "tMenuCmdTxt" character string. The character is only to be specified in the list[] array (in order to no longer have to duplicate the data, and risk making errors). Of course, the "ShowMenu()" function prints the execution character of the command. I await your validation to update the library on the net.

Have a good day !

Le mar. 21 févr. 2023 à 23:18, Rob @.***> a écrit :

You are awesome! And bilingual, so much better than me.

Enjoy your vacation, stay safe.

On Tue, Feb 21, 2023 at 2:56 PM Armand ROLLAND @.***> wrote:

hi rob I'm currently on vacation, so far from a keyboard (just the right to my phone 😭). I think I understand what you are suggesting to me. as soon as I get back to business, I get to work!

P.S. I'm trying my hand at humor but if my answer seems strange to you, please excuse me for being an incorrigible Frenchman.

Le lun. 20 févr. 2023, 19:45, Rob @.***> a écrit :

There are times when it would be handy to reprint the menu description. For instance:

tMenuCmdTxt txt_cli_power[] = "m - motor power"; tMenuCmdTxt txt_cli_forward[] = "f - forward"; tMenuCmdTxt txt_cli_backward[] = "b

backward"; tMenuCmdTxt txt_cli_full[] = "1 - full speed"; tMenuCmdTxt txt_cli_half[] = "2 - half speed";

Now, it strikes me that there is inherent duplication of effort when we put inline the character to be used for each menu item. "m - motor power"

So that leads me to the recommendation. Why not just pull the character out of the list array and print that automatically in the ShowMenu() call?

stMenuCmd cli_list[] = { {txt_cli_power, 'm', cmd_power}, {txt_cli_forward, 'f', cmd_forward}, {txt_cli_backward, 'b', cmd_backward}, {txt_cli_full, '1', cmd_full}, {txt_cli_half, '2', cmd_half},

— Reply to this email directly, view it on GitHub https://github.com/ARTS37/SerialMenuCmd/issues/1, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AUBWICXBNBTVIXBXDJ3GDJLWYO3S5ANCNFSM6AAAAAAVCGCNEY

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub < https://github.com/ARTS37/SerialMenuCmd/issues/1#issuecomment-1439141176>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AARKZXSJAX5LRDCMJFESMWDWYU2YPANCNFSM6AAAAAAVCGCNEY

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ARTS37/SerialMenuCmd/issues/1#issuecomment-1439162962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUBWICRM3TQZ3M4QMXNQ5ODWYU5KFANCNFSM6AAAAAAVCGCNEY . You are receiving this because you commented.Message ID: @.***>

ElectroLund commented 1 year ago

Oh cool. Although I'm not seeing an attachment here. Is there a branch that I'm not seeing?

On Sun, Feb 26, 2023 at 11:26 AM Armand ROLLAND @.***> wrote:

Hi Rob, I'm back !!! I have sent you the modified code as an attachment. Now, you no longer have to specify the key in the "tMenuCmdTxt" character string. The character is only to be specified in the list[] array (in order to no longer have to duplicate the data, and risk making errors). Of course, the "ShowMenu()" function prints the execution character of the command. I await your validation to update the library on the net.

Have a good day !

Le mar. 21 févr. 2023 à 23:18, Rob @.***> a écrit :

You are awesome! And bilingual, so much better than me.

Enjoy your vacation, stay safe.

On Tue, Feb 21, 2023 at 2:56 PM Armand ROLLAND @.***> wrote:

hi rob I'm currently on vacation, so far from a keyboard (just the right to my phone 😭). I think I understand what you are suggesting to me. as soon as I get back to business, I get to work!

P.S. I'm trying my hand at humor but if my answer seems strange to you, please excuse me for being an incorrigible Frenchman.

Le lun. 20 févr. 2023, 19:45, Rob @.***> a écrit :

There are times when it would be handy to reprint the menu description. For instance:

tMenuCmdTxt txt_cli_power[] = "m - motor power"; tMenuCmdTxt txt_cli_forward[] = "f - forward"; tMenuCmdTxt txt_cli_backward[] = "b

backward"; tMenuCmdTxt txt_cli_full[] = "1 - full speed"; tMenuCmdTxt txt_cli_half[] = "2 - half speed";

Now, it strikes me that there is inherent duplication of effort when we put inline the character to be used for each menu item. "m - motor power"

So that leads me to the recommendation. Why not just pull the character out of the list array and print that automatically in the ShowMenu() call?

stMenuCmd cli_list[] = { {txt_cli_power, 'm', cmd_power}, {txt_cli_forward, 'f', cmd_forward}, {txt_cli_backward, 'b', cmd_backward}, {txt_cli_full, '1', cmd_full}, {txt_cli_half, '2', cmd_half},

— Reply to this email directly, view it on GitHub https://github.com/ARTS37/SerialMenuCmd/issues/1, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AUBWICXBNBTVIXBXDJ3GDJLWYO3S5ANCNFSM6AAAAAAVCGCNEY

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub < https://github.com/ARTS37/SerialMenuCmd/issues/1#issuecomment-1439141176 , or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AARKZXSJAX5LRDCMJFESMWDWYU2YPANCNFSM6AAAAAAVCGCNEY

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub < https://github.com/ARTS37/SerialMenuCmd/issues/1#issuecomment-1439162962>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AUBWICRM3TQZ3M4QMXNQ5ODWYU5KFANCNFSM6AAAAAAVCGCNEY

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ARTS37/SerialMenuCmd/issues/1#issuecomment-1445428289, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKZXVRSP74YXNQOMHN72LWZON6XANCNFSM6AAAAAAVCGCNEY . You are receiving this because you authored the thread.Message ID: @.***>

ARTS37 commented 1 year ago

Hi Rob, I admit that I am not particularly comfortable with github. Also, it's apparently not possible for me to send you files this way. I suggest you send me your email to my email address @.***" so I can send you back 2 examples with the modified library.

May the force be with us !

Armand

Le lun. 27 févr. 2023 à 19:58, Rob @.***> a écrit :

Oh cool. Although I'm not seeing an attachment here. Is there a branch that I'm not seeing?

On Sun, Feb 26, 2023 at 11:26 AM Armand ROLLAND @.***> wrote:

Hi Rob, I'm back !!! I have sent you the modified code as an attachment. Now, you no longer have to specify the key in the "tMenuCmdTxt" character string. The character is only to be specified in the list[] array (in order to no longer have to duplicate the data, and risk making errors). Of course, the "ShowMenu()" function prints the execution character of the command. I await your validation to update the library on the net.

Have a good day !

Le mar. 21 févr. 2023 à 23:18, Rob @.***> a écrit :

You are awesome! And bilingual, so much better than me.

Enjoy your vacation, stay safe.

On Tue, Feb 21, 2023 at 2:56 PM Armand ROLLAND @.***> wrote:

hi rob I'm currently on vacation, so far from a keyboard (just the right to my phone 😭). I think I understand what you are suggesting to me. as soon as I get back to business, I get to work!

P.S. I'm trying my hand at humor but if my answer seems strange to you, please excuse me for being an incorrigible Frenchman.

Le lun. 20 févr. 2023, 19:45, Rob @.***> a écrit :

There are times when it would be handy to reprint the menu description. For instance:

tMenuCmdTxt txt_cli_power[] = "m - motor power"; tMenuCmdTxt txt_cli_forward[] = "f - forward"; tMenuCmdTxt txt_cli_backward[] = "b

backward"; tMenuCmdTxt txt_cli_full[] = "1 - full speed"; tMenuCmdTxt txt_cli_half[] = "2 - half speed";

Now, it strikes me that there is inherent duplication of effort when we put inline the character to be used for each menu item. "m - motor power"

So that leads me to the recommendation. Why not just pull the character out of the list array and print that automatically in the ShowMenu() call?

stMenuCmd cli_list[] = { {txt_cli_power, 'm', cmd_power}, {txt_cli_forward, 'f', cmd_forward}, {txt_cli_backward, 'b', cmd_backward}, {txt_cli_full, '1', cmd_full}, {txt_cli_half, '2', cmd_half},

— Reply to this email directly, view it on GitHub https://github.com/ARTS37/SerialMenuCmd/issues/1, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AUBWICXBNBTVIXBXDJ3GDJLWYO3S5ANCNFSM6AAAAAAVCGCNEY

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub <

https://github.com/ARTS37/SerialMenuCmd/issues/1#issuecomment-1439141176 ,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AARKZXSJAX5LRDCMJFESMWDWYU2YPANCNFSM6AAAAAAVCGCNEY

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub < https://github.com/ARTS37/SerialMenuCmd/issues/1#issuecomment-1439162962 , or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AUBWICRM3TQZ3M4QMXNQ5ODWYU5KFANCNFSM6AAAAAAVCGCNEY

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub < https://github.com/ARTS37/SerialMenuCmd/issues/1#issuecomment-1445428289>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AARKZXVRSP74YXNQOMHN72LWZON6XANCNFSM6AAAAAAVCGCNEY

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ARTS37/SerialMenuCmd/issues/1#issuecomment-1446885363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUBWICXT7V2DQPUVL7ZQ6JDWZT2NPANCNFSM6AAAAAAVCGCNEY . You are receiving this because you commented.Message ID: @.***>

ElectroLund commented 1 month ago

Is that modified version here on Github as a branch?