G-Node / gin-cli

Command line client for GIN
https://gin.g-node.org
Other
12 stars 6 forks source link

Fix repository listing command #149

Closed achilleas-k closed 6 years ago

achilleas-k commented 6 years ago

This PR fixes the repository listing command and adds support for outputting the results in JSON.

Repository listing commands

Public repositories that the current user is not a member of are never listed in the following results.

The new command now has four variants:

  1. gin repos is the default invocation and only lists the user's own personal repositories.
  2. gin repos --shared lists the repositories that the user is a member of excluding the user's own repositories.
  3. gin repos --all lists all repositories the current logged in user has access to (own repositories + repositories the user is a member of).
  4. gin repos <username> lists all the repositories owned by <username> that the current logged in user can access.

Variant 3 is the union of 1 and 2.

The repo listing function now uses the same API endpoint for own and other user repository listings.

The help text has been updated accordingly.

Information in listing

More information has been added to repository listings. Previously, the name and description were printed, and an information line about the repository being publicly visible when appropriate. The repository's location (GIN URL) and website have now been added to the output.

JSON repo listing

The repos command now also supports printing the results in JSON format.

Arg parsing

Small changes in arg parsing for flags (e.g., --json, --all, and --shared). Arg parsing is getting a little messy and it will get a full rewrite at some point.