onitake commented on issue #48: URL: https://github.com/apache/cloudstack-cloudmonkey/issues/48#issuecomment-641139883
This will probably need special cases for each API call or group of API calls. Alternatively, it may be possible to attach a special-case filter to arguments (such as `name`) instead. This would then automatically apply to all API calls that have this parameter. Additional care must be taken to "inject" the other parameters given by the user into the query call. Usage scenaria with special handling for `project` and `name`: 1. User enters `start virtualmachine project=abc<TAB>` 2. cmk jumps into the special handler for the `project` parameter and issues a `list projects` API call 3. cmk filters the results by the user-specified prefix "abc" and returns the list to the user 4. User selects a project from the list, then enters ` name=xy<TAB>` 5. cmk jumps into the special handler for `name` and issues a `list virtualmachines` call, passing along the other parameters (`project` in this case) 6. cmk filters the results by the "xy" prefix and presents the list of VMs to the user 7. User selects the VM from the list and presses enter to send the start command To make this work, it may be necessary to implement a sort of "translation" between the special parameters and the actual parameters sent later with the API call. For example, when autocompletion for one parameter terminates, the parameter could be automagically transformed into the actual parameter. For `project` this would mean that after the user selects the project from the list, the parameter is replaced with `projectid=<UUID>`. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org