n00b-asaurus / Redstone-Development-Kit

A collection of tools used to develop, test, and troubleshoot redstone circuits.
MIT License
11 stars 1 forks source link

Print Structure Generator argument options as a numbered list #15

Closed bobvicktor closed 3 years ago

bobvicktor commented 3 years ago

The user can type out the option or the number of the argument from the printed list. They can even type just the start of an option to select it, down to a single letter if there is only one option that starts with that letter. The selected option is then printed so the user to visually confirm the right option was selected.

Free form arguments with no options (e.g. FILE) still work the same. They get the user's input and that is it.

i.e.: STRUCTURE - What kind of structure is being built? > 1: basic_encoder 2: stenodyon_decoder 3: properinglish19_decoder Type out an option or give its index (1-3):

Typing basic_encoder, 1, bas, or b will all select basic_encoder.

n00b-asaurus commented 3 years ago

I should have merged this before commiting my changes... oh well. More work for me :)

n00b-asaurus commented 3 years ago

This is actually a really nice feature btw! the wall of text is a bit messy, but it definitely speeds up the process of getting through the structures arguments

bobvicktor commented 3 years ago

I initially was just going to add the cli arguments but then the number idea came to me so I added it too.

I thought about adding a verbose flag or something since it does turn in to a wall of text... feel free to tweak. :)

I wanted to figure out how to make some of the options cli arguments, but those arguments are determined at run time, so I’m not sure how that could be done. So I figured making picking the option easier was a good compromise.

Hmm... maybe add a cli argument that takes a list of arguments and then passes those along. That could work!

Also, I really like your argument handler. It’s pretty clever.

Bob

On Wed, Mar 10, 2021 at 10:19 PM n00b-asaurus @.***> wrote:

This is actually a really nice feature btw! the wall of text is a bit messy, but it definitely speeds up the process of getting through the structures arguments

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/n00b-asaurus/Redstone-Development-Kit/pull/15#issuecomment-796348464, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATELXU4ZG2LXK7CMAKPENBTTDAEANANCNFSM4YZ2FRRQ .

n00b-asaurus commented 3 years ago

I think I can tweak it to add a verbose flag. Thanks for the complement also :) I figured it might be a good idea to let the structure register the arguments it needs at run time, since the plan is to have the structure generator handle more than just ROMs, and not all instructions will require the same arguments.

You may be right about passing the arguments as a list. That would probably be easiest.

bobvicktor commented 3 years ago

Yeah, it makes sense why you did the arguments that way. Not every structure needs the same things.

One thought was to pick out a set of standard arguments that every structure will need, like facing direction, but if some are still run time one not sure how much that would help. Now that we’ve had argument list idea that should work nicely. Thinking about common arguments gave me another idea though. You probably already plan on doing this, but new structures should keep what common arguments they have in the same order so people can remember what order things go in.

I’m on my phone and won’t be at a computer for about a week, and maybe won’t be able to really look at the code again until March 22, so I can’t really work on a working concept, but one idea I had would start something like this:

parser.add_argument(‘-a’, ‘—arguments’, nargs=‘+’, help=‘Arguments to pass to the structure generator for the chosen structure.’)

And then pass args.arguments to the argument_handler and have it take each argument off the list one at a time and use it instead of user input. And if a structure needs more arguments than were given it asks for the rest.

It would be nice if the arguments were handled the same way as user input, so people can pass in numbers to short names, just like when typing in arguments.

I look forward to using the tools myself someday. ;)

On Thu, Mar 11, 2021 at 1:01 AM n00b-asaurus @.***> wrote:

I think I can tweak it to add a verbose flag. Thanks for the complement also :) I figured it might be a good idea to let the structure register the arguments it needs at run time, since the plan is to have the structure generator handle more than just ROMs, and not all instructions will require the same arguments.

You may be right about passing the arguments as a list. That would probably be easiest.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/n00b-asaurus/Redstone-Development-Kit/pull/15#issuecomment-796428304, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATELXU35IMENFW7HTARIUZDTDAW7BANCNFSM4YZ2FRRQ .