Skip to content

Conversation

ATGE
Copy link
Contributor

@ATGE ATGE commented Feb 11, 2020

No description provided.

@coveralls
Copy link

coveralls commented Feb 11, 2020

Coverage Status

Coverage increased (+0.009%) to 93.832% when pulling 264c674 on ATGE:issue1221 into be19a02 on softlayer:master.

@allmightyspiff
Copy link
Member

I don't know why that pypy3.5 test is failing, I'll have to figure that out.

Copy link
Member

@allmightyspiff allmightyspiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this issue. Let me know if you have any questions about the changes I requested.

import time
import traceback
import types
import urllib3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use requests, which contains its own json stuff, so you can remove the json import as well.

And add this constant:
PROG_NAME = "slcli (SoftLayer Command-line)"

return latest


def get_version_message():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will actually call get_latest_version() for EVERY command run. So lets do the following:

def get_version_message(ctx, param, value):
    if not value or ctx.resilient_parsing:
        return

    current = SoftLayer.consts.VERSION
    latest = get_latest_version()
    click.secho("Current: {prog} {current}\nLatest:  {prog} v{latest}".format(
        prog=PROG_NAME, current=current, latest=latest))
    ctx.exit()

required=False,
help="Use demo data instead of actually making API calls")
@click.version_option(prog_name="slcli (SoftLayer Command-line)")
@click.version_option(prog_name="slcli (SoftLayer Command-line)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this will allow us to only query for the latest version only when someone actually runs --version.

@click.option('--version', is_flag=True, expose_value=False, is_eager=True, callback=get_version,
              help="Show version information.")

@allmightyspiff allmightyspiff merged commit 47fc7e6 into softlayer:master Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants