[Pulp-dev] Pulp3 MVP Refinement Next Steps
David Davis
daviddavis at redhat.com
Fri Mar 10 18:08:50 UTC 2017
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:
https://github.com/Apipie/apipie-rails
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:
https://github.com/theforeman/hammer-cli/tree/master/lib/hammer_cli/apipie
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.
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:
https://git.io/vyrsy
<https://github.com/theforeman/hammer-cli-foreman/blob/master/lib/hammer_cli_foreman/user.rb>
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.
David
On Fri, Mar 10, 2017 at 12:48 PM, Sean Myers <sean.myers at redhat.com> wrote:
> On 03/03/2017 04:09 PM, David Davis wrote:
> > This is essentially what foreman and katello do, and it works great. They
> > get an json export of the REST API structure from the server and then map
> > each endpoint to a command and the parameters to options. One can still
> > override the default functionality for each command (or add extra
> commands)
> > but for most commands, there isn't any code required.
>
> I'd love to avoid wheel reinvention here, got a link handy?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-dev/attachments/20170310/80671370/attachment.htm>
More information about the Pulp-dev
mailing list