Skip to content

Commit

Permalink
Merge pull request #47 from cs50/develop
Browse files Browse the repository at this point in the history
2.1.0
  • Loading branch information
dmalan authored Mar 12, 2018
2 parents 554b5c7 + 180511e commit 2961624
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions cli50
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import argparse
import distutils.spawn
Expand Down Expand Up @@ -35,7 +35,9 @@ def main():
parser.add_argument("-f", "--fast", action="store_true", help="skip autoupdate")
parser.add_argument("-g", "--git", action="store_true", help="mount .gitconfig")
parser.add_argument("-p", "--publish", action="append",
help="publish container's port(s) to host", metavar="LIST", nargs="?")
help="publish port(s) to ports on host", metavar="LIST", nargs="?")
parser.add_argument("-P", "--publish-all", action="store_true",
help="publish exposed ports to random ports on host")
parser.add_argument("-s", "--ssh", action="store_true", help="mount .ssh")
parser.add_argument("-S", "--stop", action="store_true", help="stop any containers")
parser.add_argument("-t", "--tag", default="latest",
Expand Down Expand Up @@ -137,12 +139,14 @@ def main():

# Ports to publish
if isinstance(args["publish"], list):
if len(args["publish"]) == 0: # If --publish without LIST
options += ["--publish", "8080", "--publish", "8081:8081", "--publish", "8082:8082"]
if len(args["publish"]) == 1 and args["publish"][0] == None: # If --publish without LIST
options += ["--publish", "8080:8080", "--publish", "8081:8081", "--publish", "8082:8082"]
else: # If --publish with LIST
for port in args["publish"]:
if port:
options += ["--publish", port]
if args["publish_all"]:
options += ["--publish-all"]

# Mount ~/.gitconfig read-only, if exists
if args["git"]:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
python_requires=">=3.6",
scripts=["cli50"],
url="https://github.com/cs50/cli50",
version="2.0.3"
version="2.1.0"
)

0 comments on commit 2961624

Please sign in to comment.