Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dmalan committed Dec 2, 2019
2 parents f687144 + f9ab4a3 commit 42dd7f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions cli50/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,25 @@ def main():
"docker", "ps",
"--all",
"--filter", "status=running",
"--format", "{{.ID}}\t{{.Image}}\t{{.RunningFor}}\t{{.Mounts}}",
"--format", "{{.ID}}\t{{.Image}}\t{{.RunningFor}}\t{{.Status}}\t{{.Mounts}}",
"--no-trunc"
]).decode("utf-8")
except subprocess.CalledProcessError:
sys.exit(1)
else:
containers = []
for line in stdout.rstrip().splitlines():
ID, Image, RunningFor, *Mounts = line.split("\t")
ID, Image, RunningFor, Status, *Mounts = line.split("\t")
Mounts = Mounts[0].split(",") if Mounts else []
Mounts = [Mount for Mount in Mounts if not re.match(r"^[0-9a-fA-F]{64}$", Mount)] # Ignore hashes
containers.append((ID, Image, RunningFor.lower(), Mounts))
containers.append((ID, Image, RunningFor.lower(), Status.lower(), Mounts))
if not containers:
sys.exit("No containers are running.")

# Ask whether to use a running container
for ID, Image, RunningFor, Mounts in containers:
for ID, Image, RunningFor, Status, Mounts in containers:
while True:
prompt = _("Log into {}, started {}").format(Image, RunningFor)
prompt = _("Log into {}, created {}, {},").format(Image, RunningFor, Status)
if Mounts:
prompt += _(" with {} mounted").format(inflect.engine().join(Mounts))
prompt += "? [Y] "
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"console_scripts": ["cli50=cli50.__main__:main"]
},
url="https://github.com/cs50/cli50",
version="3.5.1",
version="3.5.2",
include_package_data=True
)

0 comments on commit 42dd7f3

Please sign in to comment.