<div dir="ltr">Yea, I’m including @tstrachota here to correct me if I’m wrong. In foreman/katello, they use apipie to document the api and this produces the structure in json:<div><br></div><div><a href="https://github.com/Apipie/apipie-rails" target="_blank">https://github.com/Apipie/<wbr>apipie-rails</a><br></div><div><br></div><div>The CLI is written using hammer-cli. It takes the apipie json (which it also caches) and turns it into commands/options. Here’s that code:</div><div><br></div><div><a href="https://github.com/theforeman/hammer-cli/tree/master/lib/hammer_cli/apipie" target="_blank">https://github.com/theforeman/<wbr>hammer-cli/tree/master/lib/<wbr>hammer_cli/apipie</a><br></div><div><br></div><div>I’m not sure if it’s generic enough for us to use though unfortunately. Maybe it could be though? Also, it’s in Ruby of course.</div><div><br></div><div>Lastly, here’s just an example of the user set of cli commands. It looks longer than it ought to be due to i18n of the field names but take a look at create/update/delete:</div><div><br></div><div><a href="https://github.com/theforeman/hammer-cli-foreman/blob/master/lib/hammer_cli_foreman/user.rb" target="_blank">https://git.io/vyrsy</a><br></div><div><br></div><div>At the very least, I think hammer-cli is a great example of one direction we could take in order to eliminate redundant code and make our CLI mostly dynamic.</div><div><br></div><div><br></div><div class="gmail_extra"><br clear="all"><div><div class="m_-8815158597132650890gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><br></div><div>David<br></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Fri, Mar 10, 2017 at 12:48 PM, Sean Myers <span dir="ltr"><<a href="mailto:sean.myers@redhat.com" target="_blank">sean.myers@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 03/03/2017 04:09 PM, David Davis wrote:<br>
> This is essentially what foreman and katello do, and it works great. They<br>
> get an json export of the REST API structure from the server and then map<br>
> each endpoint to a command and the parameters to options. One can still<br>
> override the default functionality for each command (or add extra commands)<br>
> but for most commands, there isn't any code required.<br>
<br>
</span>I'd love to avoid wheel reinvention here, got a link handy?<br>
<br>
</blockquote></div><br></div></div>