UI Style Guide Shell WIKI - templates

This forum is for general developer support questions.

UI Style Guide Shell WIKI - templates

Postby xenic » Wed May 11, 2016 9:57 pm

I noticed that the template for the requestchooser command in the A-EON enhancer package has 3 string arguments without a required keyword (/K). That means that if you enter args in the wrong order or leave out one of the string args you will get a requester with text in the wrong places. It seems to me that only one string arg should have no keyword required and any other string arguments should have /K (keyword required) so that the arguments can be entered in any order.

I think the UI Style Guide Shell WIKI should be updated to recommend that templates should only have one string keyword that doesn't require a keyword and any other string keywords should be marked /K (keyword required).
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1145
Joined: Sun Jun 19, 2011 1:06 am

Re: UI Style Guide Shell WIKI - templates

Postby thomasrapp » Thu May 12, 2016 11:00 pm

There is nothing wrong with the template. An absent /K does not mean you may not use keywords, you just don't need to specify them. If you want to reorder the arguments, you can still use the keywords.

For example if the template is TITLE,BODY,BUTTON

you can use: Greetings "Hello World" Ok

but you can as well use: BUTTON Ok TITLE Greetings BODY "Hello World!"

/K should only be used if it avoids confusion, it should not create it.

For example with the standard RequestChoice command:

requestchoice a b c d

is absolutely valid and does not need any keywords (a is title, b is body and c and d are buttons). No need for /K.
User avatar
thomasrapp
 
Posts: 253
Joined: Sun Jun 19, 2011 12:22 am

Re: UI Style Guide Shell WIKI - templates

Postby xenic » Sat May 14, 2016 1:04 am

thomasrapp wrote:There is nothing wrong with the template. An absent /K does not mean you may not use keywords, you just don't need to specify them. If you want to reorder the arguments, you can still use the keywords.

For example if the template is TITLE,BODY,BUTTON

you can use: Greetings "Hello World" Ok

but you can as well use: BUTTON Ok TITLE Greetings BODY "Hello World!"

/K should only be used if it avoids confusion, it should not create it.

For example with the standard RequestChoice command:

requestchoice a b c d

is absolutely valid and does not need any keywords (a is title, b is body and c and d are buttons). No need for /K.


On the other hand "RequestFIle" has one string argument that doesn't require a keyword and all the remaining string arguments require the keyword. It's less confusing than remembering in what order multiple string args must be entered. I didn't say there was anything wrong with the template; I'm suggesting that a recommendation that "multiple string arguments except one have a required keyword" be added to the style guide WIKI.
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1145
Joined: Sun Jun 19, 2011 1:06 am

Re: UI Style Guide Shell WIKI - templates

Postby broadblues » Sat May 14, 2016 1:16 pm

I don't see your logic, templates are design to work the way they are being used in RequestChoise (which I coppied over inot RequestChooser).

IMHO (and this is just MHO) keywords should be used when there is a default value to override

eg for a 'save' arrex function where the default is the current filename I might do

SAVEIMAGE FILENAME/K

but for a 'save as' where a new file must always be chosen

SAVEIMAGEAS FILENAME/A

Other combinataion and intreptations are valid.
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 538
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: UI Style Guide Shell WIKI - templates

Postby xenic » Sun May 15, 2016 7:57 pm

broadblues wrote:I don't see your logic

The logic is to make shell commands as errorproof as possible. My proposal applies to current AmigaDOS
commands as well. Consider the copy command:

The copy command doesn't require a keyword for the "TO" argument. If the user intends to replace a file by copying ram:myfile to dh0:myfile and accidently reverses the argument order (copy dh0:myfile ram:myfile) then he has lost the file he actually wanted to copy. In addition, the from argument has a "/M" option which means that entering multiple names and forgetting to enter the TO keyword would produce unpredictable results. If the template for the TO argument were " TO/K/A " potential errors could be avoided.

What I proposed was a recommendation in the WIKI and not a requirement.
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1145
Joined: Sun Jun 19, 2011 1:06 am

Re: UI Style Guide Shell WIKI - templates

Postby broadblues » Mon May 16, 2016 1:17 pm

There no ambiguity at all in COPY with no keywords the last argument is the destination, if there is more than one src argument the destination is treated as a directory name (and created if not present).

It is in fact an excellent example of why restricting to one argument without a keywaord is abad thing.
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 538
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 2 guests