Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions payu/subcommands/clone_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
import questionary
import subprocess
import sys
try:
from prompt_toolkit.completion import PathCompleter
has_completer = True
except ImportError:
has_completer = False
from prompt_toolkit.completion import PathCompleter

from payu.branch import clone
import payu.subcommands.args as args
Expand Down Expand Up @@ -205,10 +201,10 @@ def safe_ask(question_obj):

def ask_for_repo_url():
"""Ask the user for the repository URL they want to clone."""
path_completer = PathCompleter(only_directories=True, expanduser=True) if has_completer else None
path_completer = PathCompleter(only_directories=True, expanduser=True)
return safe_ask(questionary.text(
"Please enter the URL of the repository, or the local path of a configuration you want to clone:",
instruction=example_url_msg+"; 'Tab' to browse, '/' to enter folder)" if has_completer else ")",
instruction=example_url_msg+"; 'Tab' to browse, '/' to enter folder)",
validate=lambda text: True if text else "Repository URL/directory cannot be empty.",
completer=path_completer
))
Expand Down Expand Up @@ -309,8 +305,8 @@ def validate_restart_path(path_str):

def ask_for_restart_path():
"""Ask the user for the path to the restart directory they want to use."""
path_completer = PathCompleter(only_directories=True, expanduser=True) if has_completer else None
instruction = " ('Tab' to browse, '/' to enter folder):" if has_completer else ":"
path_completer = PathCompleter(only_directories=True, expanduser=True)
instruction = " ('Tab' to browse, '/' to enter folder):"
return safe_ask(questionary.text(
"Please enter the restart path you want to use" + instruction,
validate=validate_restart_path,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies = [
"colorama",
"filelock",
"questionary",
"prompt_toolkit >=3.0.0"
]

[project.optional-dependencies]
Expand Down
Loading