-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up command construction to support generic iterables and mappings (…
…#595) First step in working on #584. - `Command.add_args_list()` previously had a misleading name and type annotation - it is used for accepting either a list or a single item. Renamed to `Command.add_args_iterable_or_single()`. - Added `Command.add_args_iterable()` for the case you know you're dealing with an iterable (more efficient than always creating a new list). - Updated `utils.to_list()` to support generic iterables (still always returns a list, as per the name - my plan is to phase out its use where it's not needed). - Updated `utils.format_dict_for_cli()` to support generic mappings. - Added `Command.add_args_mapping()` as a convenience that wraps `utils.format_dict_for_cli()`, which will allow tidying up code that constructs commands. Next step is to tidy up the components' code that constructs commands, allowing arguments to be `Iterable` and `Mapping` in place of `List` and `Dict`. With these changes it should be fairly straightforward, simply calling the correct method on the `Command` class. Here's an example of what upcoming changes look like: LewisGaul/python-on-whales@command-construction...command-construction-image
- Loading branch information
Showing
13 changed files
with
214 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.