ikabot icon indicating copy to clipboard operation
ikabot copied to clipboard

Named arguments for predetermined input

Open Kiskadee-dev opened this issue 1 year ago • 2 comments

I feel like the project would benefit from having named arguments

example:

ikabot login passwd sendres --from city1 --to city2 --resource wine --amount 50000

Easy to understand and not that hard to add as an optional form to not break backwards compatibility

Kiskadee-dev avatar Sep 04 '23 02:09 Kiskadee-dev

I don't really like this idea because it will make the command_line.py module too complicated. We would have to translate the arguments to number choices and I think that would be a bit too hard to debug for people using predetermined arguments. Keep in mind that if this proposal is accepted, we will have to make sure all future modules have this translation. We will also have to find the right order of the arguments before translation.

I feel like the alternative to translating the parameters isn't much better as it would involve extensively modifying all modules and/or the main command_line.py module.

ikagod avatar Sep 05 '23 11:09 ikagod

Delegating the named argument to the function would be the way to make this optional, in the example, sendres as its not a number would start the section for the named arguments and then pop the inputs until another delimiter is found, since we're dealing with named args then any arg without a name can be the ending delimiter.

this subsection would be parsed and sent to the function as **kwargs and the function would check for them to modify its own behaviour, it'd be entirely optional for the author to make args for his own function.

eg: ikabot [login, passwd] [function name/any non integer] [--from city1 --to city2 --resource wine --amount 50000 ] 14 2 3 ...

Kiskadee-dev avatar Sep 05 '23 13:09 Kiskadee-dev