65MO / Galaxy-E

Towards a Galaxy for Ecology
Other
6 stars 11 forks source link

gdal review #37

Open bgruening opened 5 years ago

bgruening commented 5 years ago
<param name="sql" type="text" label="-sql statement" value="eg : SELECT * FROM Shapefile WHERE X>10" help="Your input is renamed Shapefile.">

    #unless $settings.sql=='eg : SELECT * FROM Shapefile WHERE X>10':
        -sql '$settings.sql'
    #end unless

You could also add the label from above to the help and call the label just SQL query to perform again your dataset. The #unless can be removed completely and should make your tool way smaller. This can be done in a lot of places. Please note that you do not set value="eg: SELECT ..." so the unless is really unnecessary.

Same here: <param name="wo" type="text" label="-wo" value="NAME=VALUE" /> putting the content from the value in the help would remove the unless and make your tool look better to the user imho. unless is really used very rarely I guess, so there should be ways to avoid it :)

Alanamosse commented 5 years ago

Hi @bgruening ! Looking back to gdal tools I'm not sure to understand why you said that 'unless' statements are not optimal. Some options needs to be called with a value and unless allows me to check that.

Back then I added option1Value examples in the wrapper value field to check like follow : <param name="option1Value" value="eg : some value" ... `#unless option1Value=='eg some value' -option option1Value

end unless`

it's the same as empty value in the wrapper and : <param name="option1Value" value="" help="eg : some value" ... `#if option1Value!="" -option option1Value

end if`

If I do not check option1Value content I will probably encounter issues with options that can't be empty. For example -sql '' will probably fail. Is it just that if statement are more natural that unless ?

bgruening commented 5 years ago

Yes IF is really more convenient than unless. If you want please look at https://github.com/galaxyproject/tools-iuc/tree/master/tools/gemini these are a lot of tools that also allow partially SQL syntax. You can also look at those tools at usegalaxy.eu.

Alanamosse commented 5 years ago

Ok ! gemini tools are great with advanced use of macros thks to pointed them out.

I see its possible to checks empty param values either with a if!='' in command block or with a validator field in <param/> block. I guess validator should be favoured

bgruening commented 5 years ago

Thanks @Alanamosse for doing all this. This is pretty amazing!