flyctl icon indicating copy to clipboard operation
flyctl copied to clipboard

Read the `--org` flag when running the `flyctl tokens list` command

Open KTanAug21 opened this issue 1 year ago • 0 comments

Change Summary

What: This PR updates a part of the logic when flyctl tokens list is run:

  1. Read the organization name from the argument passed for --org
  2. Determine the "scope" ( either filter by app, or by org ) of tokens to display based on the flags passed:
    --app--orgScope
    NONENONEfilter by app(DEFAULT)
    SpecifiedNONEfilter by app
    SpecifiedSpecifiedfilter by app
    NONESpecifiedfilter by org

Why:

  1. For consistency with the manner of retrieving the organization name from the user:

Other sub commands under flyctl tokens can read the organization name through reading the --org flag . i.e. flyctl tokens create org

  1. For consistency with how the scope of filtering the list of tokens be specified by the user:

The flyctl tokens list has two scopes of filtering the tokens it displays: a) by app( default ) b) by organization The flyctl tokens list already filters the list of tokens by the app simply by reading the app name from the --app flag. Allowing it to read the --org flag, and filtering the tokens by organization can comply with the syntax used for filtering by app.

How:

  1. Include fly.Org() to the flags for the flyctl tokens list command
  2. Detect scope to filter list of tokens based on the combination( or lack of ) of --app and --org flags passed

Todo:

  1. Return reading scope from --s( because I removed it! Must bring this back so it's still compatible with how scope was specified previously.
  2. Create test cases to test the resulting scope used based on different --app and --org flag combinations

Related to: Discourse post: https://flyio.discourse.team/t/approach-to-inconsistency-in-reading-organization-name-input-for-subcommands-in-flyctl-tokens/6612


Documentation

  • [ ] Fresh Produce
  • [ ] In superfly/docs, or asked for help from docs team
  • [ ] n/a

KTanAug21 avatar Jul 30 '24 18:07 KTanAug21