cmd/route-cli: implement 'route token inspect'

This commit is contained in:
Cadey Ratio 2017-10-01 08:43:45 -07:00
parent 7927c4d4f3
commit 026f061b0a
No known key found for this signature in database
GPG Key ID: D607EE27C2E7F89A
1 changed files with 10 additions and 0 deletions

View File

@ -320,6 +320,16 @@ retry_netrc:
fmt.Printf("Your token is: %s\n", ftkn.Body)
fmt.Printf("It has permission for the following scopes: %v\n", ftkn.Scopes)
return
case "token inspect":
tkn, err := tc.Get(ctx, &proto.GetTokenRequest{Id: *tokenInspectID})
if err != nil {
ln.FatalErr(ctx, err, ln.Action("fetch token from server"), ln.F{"token_id": *tokenInspectID})
}
json.NewEncoder(os.Stdout).Encode(tkn)
return
}