简体   繁体   English

Ocif 动态自动完成与 http 调用

[英]Oclif dynamic autocomplete with http call

Does Oclif support making a call to an API and getting the values returned in order to be used for autocomplete? Oclif 是否支持调用 API 并获取返回值以用于自动完成? I have the following use case:我有以下用例:

  • Multiple users are stored in a database多个用户存储在一个数据库中
  • When the user presses show users <Tab> <Tab> , the CLI should make a call to an API that returns all available users.当用户按下show users <Tab> <Tab> ,CLI 应调用返回所有可用用户的 API。
  • The CLI should use the values returned from the API. CLI 应使用从 API 返回的值。
  • The user can then select a user name, for example show users user0001 .然后用户可以选择一个用户名,例如show users user0001

Is this possible in Oclif?这在 Oclif 中可能吗?

'It is not possible in Oclif, however the Heroku CLI does this. '这在 Oclif 中是不可能的,但是 Heroku CLI 可以做到这一点。 Check outhttps://github.com/heroku/cli/tree/master/packages/autocomplete for more information.'查看https://github.com/heroku/cli/tree/master/packages/autocomplete了解更多信息。

This is the answer from Oclif team regarding this issue.这是 Oclif 团队对这个问题的回答。 https://github.com/oclif/oclif/issues/332 https://github.com/oclif/oclif/issues/332

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM