autolab / Autolab-CLI

Command line autolab client that uses the Autolab API
3 stars 2 forks source link

Changed code structure, added tab autocompletion #4

Closed TheodorJ closed 6 years ago

TheodorJ commented 6 years ago

Just tested -h, everything still works

zyx-billy commented 6 years ago

looks cool! The new alias map seems like a straightforward way of dealing with aliases. Part of the redundancy I was referring to yesterday was checking if a valid command exists in the info_map when getting its usage string. Now that we loop through info_map directly, there's no need to query the map for the command_info any more since we get it by default with the iterator. I've updated the code with what I mean. (with some minor style changes to be more concise).

zyx-billy commented 6 years ago

Before merging though, the seemingly random amount of spaces in the usage strings are kind of annoying... Now that the strings are all spread out, it's going to be quite hard to align them if we add additional commands in the future. I'm going to try and get them aligned...

TheodorJ commented 6 years ago

Sounds like something we can automate -- the length of the string of spaces is equal to the longest command plus one character

zyx-billy commented 6 years ago

ah that's true. I guess we could do that. I was originally going to propose a dead simple list initialization image But I guess doing it dynamically inside print_help() works too (that's actually how the help text for the individual commands are generated rn). The only problem is we have to somehow reverse the alias_map.