Read the `--org` flag when running the `flyctl tokens list` command
Change Summary
What:
This PR updates a part of the logic when flyctl tokens list is run:
- Read the organization name from the argument passed for
--org - Determine the "scope" ( either filter by app, or by org ) of tokens to display based on the flags passed:
--app --org Scope NONE NONE filter by app(DEFAULT) Specified NONE filter by app Specified Specified filter by app NONE Specified filter by org
Why:
- For consistency with the manner of retrieving the organization name from the user:
Other sub commands under
flyctl tokenscan read the organization name through reading the--orgflag . i.e.flyctl tokens create org
- For consistency with how the scope of filtering the list of tokens be specified by the user:
The
flyctl tokens listhas two scopes of filtering the tokens it displays: a) by app( default ) b) by organization Theflyctl tokens listalready filters the list of tokens by the app simply by reading the app name from the--app flag. Allowing it to read the--orgflag, and filtering the tokens by organization can comply with the syntax used for filtering by app.
How:
- Include
fly.Org()to the flags for theflyctl tokens listcommand - Detect scope to filter list of tokens based on the combination( or lack of ) of
--appand--orgflags passed
Todo:
- Return reading scope from
--s( because I removed it! Must bring this back so it's still compatible with how scope was specified previously. - 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