Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subcommands #6

Merged
merged 8 commits into from
Nov 18, 2020
Merged

subcommands #6

merged 8 commits into from
Nov 18, 2020

Conversation

kzidane
Copy link
Member

@kzidane kzidane commented Nov 17, 2020

E.g.,

ide50 start ...
ide50 stop
ide50 status
...

@kzidane kzidane requested a review from dmalan November 17, 2020 17:24
"""Print container port mappings and URL"""
# List port mappings
print(ports(container))
print(_("Running on {}. Run `ide50 -S` to stop.").format(
Copy link
Member

Choose a reason for hiding this comment

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

ide50 stop?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! Fixed. Thanks!

repository, tag = image.split(":") if ":" in image else (image, "latest")
if "/" not in repository:
repository = "library/" + repository

Copy link
Member

Choose a reason for hiding this comment

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

unnecessary blank line?

Copy link
Member Author

Choose a reason for hiding this comment

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

I typically use a blank line after ifs, fors, groups of related statements, multi-line statements, etc to visually separate them https://www.python.org/dev/peps/pep-0008/#blank-lines.

pass
except AssertionError:
print(_("A newer version is available. Run `pip3 install --upgrade ide50` to upgrade."))

Copy link
Member

Choose a reason for hiding this comment

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

comment?

except subprocess.CalledProcessError:

# Publish all exposed ports to random ports
try:
container = subprocess.check_output([*cmd, "--publish-all", args.image]).decode().rstrip()
container = subprocess.check_output([*cmd, "--publish-all",
Copy link
Member

Choose a reason for hiding this comment

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

clever

print(ports(container))
print(_("Running on {}. Run `ide50 -S` to stop.").format(f"http://{ports(container.split()[0], C9_PORT)}/"))

container_info(container)
Copy link
Member

Choose a reason for hiding this comment

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

comment?

def pull(image):
"""Pull image as needed."""
try:
sys.exit(0)
Copy link
Member

Choose a reason for hiding this comment

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

unnecessary blank line?

@kzidane kzidane merged commit b21f58e into main Nov 18, 2020
@kzidane kzidane deleted the subcommands branch November 18, 2020 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants