Skip to content

Commit

Permalink
feat(push): add url to see version
Browse files Browse the repository at this point in the history
  • Loading branch information
Caceresenzo committed Mar 28, 2023
1 parent be46d8e commit 27c19c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion crunch_cli/command/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
import tempfile
import requests
import gitignorefile
import urllib.parse

from .. import utils
from .. import constants


def push(
session: requests.Session,
message: str
message: str,
web_base_url: str = None,
):
utils.change_root()

Expand Down Expand Up @@ -56,3 +58,7 @@ def push(

print("\n---")
print(f"version #{version['number']} uploaded!")

if web_base_url is not None:
url = urllib.parse.urljoin(web_base_url, f"/project/versions/{version['number']}")
print(f"check your version: {url}")
9 changes: 8 additions & 1 deletion crunch_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@

session = None
debug = False
web_base_url = None


@click.group()
@click.option("--debug", "enable_debug", envvar="DEBUG", is_flag=True, help="Enable debug output.")
@click.option("--api-base-url", envvar="API_BASE_URL", required=True, help="Set the API base url.")
@click.option("--web-base-url", "web_base_url_value", envvar="WEB_BASE_URL", help="Set the Web base url.")
def cli(
enable_debug: bool,
api_base_url: str,
web_base_url_value: str,
):
global debug
debug = enable_debug

global session
session = utils.CustomSession(api_base_url, debug)

global web_base_url
web_base_url = web_base_url_value


@cli.command(help="Setup a workspace directory with the latest version of you code.")
Expand Down Expand Up @@ -48,7 +54,8 @@ def push(
):
command.push(
session,
message=message
message=message,
web_base_url=web_base_url
)


Expand Down

0 comments on commit 27c19c2

Please sign in to comment.