Skip to content

Commit ed7df88

Browse files
committed
support git urls
1 parent d5c9cc8 commit ed7df88

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ipython2cwl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.1"
1+
__version__ = "0.0.2"

ipython2cwl/repo2cwl.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def _store_jn_as_script(notebook_path: str, git_directory_absolute_path: str, bi
5656
'DO NOT EDIT THIS FILE',
5757
'THIS FILE IS AUTO-GENERATED BY THE ipython2cwl.',
5858
'FOR MORE INFORMATION CHECK https://github.com/giannisdoukas/ipython2cwl',
59+
'\n\n',
5960
'"""',
6061
converter._wrap_script_to_method(converter._tree, converter._variables)
6162
])
@@ -97,6 +98,8 @@ def repo2cwl(argv: Optional[List[str]] = None) -> int:
9798
argv = sys.argv[1:] if argv is None else argv
9899
args = parser_arguments(argv)
99100
uri: ParseResult = args.repo[0]
101+
if uri.path.startswith('git@') and uri.path.endswith('.git'):
102+
uri = urlparse(f'ssh://{uri.path}')
100103
output_directory: Path = args.output
101104
supported_schemes = {'file', 'http', 'https', 'ssh'}
102105
if uri.scheme not in supported_schemes:
@@ -113,6 +116,10 @@ def repo2cwl(argv: Optional[List[str]] = None) -> int:
113116
local_git = git.Repo.init(local_git_directory)
114117
local_git.git.add(A=True)
115118
local_git.index.commit("initial commit")
119+
elif uri.scheme == 'ssh':
120+
url = uri.geturl()[6:]
121+
logger.info(f'cloning repo {url} to temp directory: {local_git_directory}')
122+
local_git = git.Repo.clone_from(url, local_git_directory)
116123
else:
117124
logger.info(f'cloning repo to temp directory: {local_git_directory}')
118125
local_git = git.Repo.clone_from(uri.geturl(), local_git_directory)

0 commit comments

Comments
 (0)