linode / linode-cli

The official Linode command line interface.
https://linode.com
BSD 3-Clause "New" or "Revised" License
371 stars 132 forks source link

[Feature]: Config based "--suppress-warnings" or, more specifically, quiet version mismatch warning #582

Closed bnjmn closed 1 week ago

bnjmn commented 6 months ago

Description (Problem / Annoyance)

Calling linode-cli without --suppress-warnings will almost always output a version mismatch warning at the rate this library changes. Using linode-cli in scripts requires adding this argument to every call; or get noisy version mismatch messages in logs that are not really helpful for automated processes.

Proposal

This flag setting should be configurable via ./config/linode-cli or an ENV VAR (or both ideally).

References

Here is the code where the warning is generated.

Example usage currently relying on sys.argv instead of CLI.suppress_warnings (here)

Extra

I could potentially help out with this if it is something that the community/maintainers are open to.

Potential Usage Example

linode-cli account view
The API responded with version 4.173.0, which is newer than the CLI's version of 4.170.2.  Please update the CLI to get access to the newest features.  You can update with a simple `pip3 install --upgrade linode-cli`
┌────────────┬───────────┬──────────────────────┬─────────┬────────────────────┐
│ first_name │ last_name │ email                │ balance │ balance_uninvoiced │
├────────────┼───────────┼──────────────────────┼─────────┼────────────────────┤
│ Larry      │ Linode    │ linode@linode.com    │ 0.0     │ 1,000,000.00       │
└────────────┴───────────┴──────────────────────┴─────────┴────────────────────┘

export LINODE_CLI_SUPPRESS_VERSION_WARNING=true 
linode-cli account view
┌────────────┬───────────┬──────────────────────┬─────────┬────────────────────┐
│ first_name │ last_name │ email                │ balance │ balance_uninvoiced │
├────────────┼───────────┼──────────────────────┼─────────┼────────────────────┤
│ Larry      │ Linode    │ linode@linode.com    │ 0.0     │ 1,000,000.00       │
└────────────┴───────────┴──────────────────────┴─────────┴────────────────────┘

Or this could be something like this in linode-cli config

[DEFAULT]
default-user = DEFAULT
region = us-southeast
type = g6-standard-2
suppress-warnings = false
suppress-version-warning = true
yec-akamai commented 5 months ago

@bnjmn Thank you for the feature request! We've made an internal ticket to implement it.