Repository: ARMmbed/mbed-tools

Issue:
mbed-tools import fails to import an example with ssh url
### Description

<!--
A detailed description of what is being reported. Please include steps to reproduce the problem.

Things to consider sharing:
- What version of the package is being used (pip show mbed-tools)?
- What is the host platform and version (e.g. macOS 10.15.2, Windows 10, Ubuntu 18.04 LTS)?
-->

mbed-tools version: **5.0.0**

Command:

`mbed-tools -vv import git@github.com:ARMmbed/mbed-os-example-blinky.git`

Expected:

mbed-os-example-blinky example cloned onto a local machine.

 

Output:

```

Cloning Mbed program 'git@github.com:ARMmbed/mbed-os-example-blinky.git'
Resolving program library dependencies.
ERROR: Cloning git repository from url 'https://github.com/armmbed/git@github.com:ARMmbed/mbed-os-example-blinky.git' failed. Error from VCS: Cmd('git') failed due to: exit code(128)
cmdline: git clone --progress -v https://github.com/armmbed/git@github.com:ARMmbed/mbed-os-example-blinky.git mbed-os-example-blinky.git

More information may be available by using the command line option '-vvv'.

```


### Issue request type

<!--
Please add only one `x` to one of the following types. Do not fill multiple types (split the issue otherwise).


For questions please use https://forums.mbed.com/
-->

- [ ] Enhancement
- [x] Bug


Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/ARMmbed/mbed-tools/pull/190?src=pr&el=h1) Report
> Merging [#190](https://codecov.io/gh/ARMmbed/mbed-tools/pull/190?src=pr&el=desc) (68c47da) into [master](https://codecov.io/gh/ARMmbed/mbed-tools/commit/73d90030d995a3da7a518d69ec70c9a54fd59579?el=desc) (73d9003) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/ARMmbed/mbed-tools/pull/190/graphs/tree.svg?width=650&height=150&src=pr&token=QFRIdRv91G)](https://codecov.io/gh/ARMmbed/mbed-tools/pull/190?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master     #190   +/-   ##
=======================================
  Coverage   96.56%   96.56%           
=======================================
  Files          94       94           
  Lines        2619     2621    +2     
=======================================
+ Hits         2529     2531    +2     
  Misses         90       90           
```


| [Impacted Files](https://codecov.io/gh/ARMmbed/mbed-tools/pull/190?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/mbed\_tools/project/mbed\_program.py](https://codecov.io/gh/ARMmbed/mbed-tools/pull/190/diff?src=pr&el=tree#diff-c3JjL21iZWRfdG9vbHMvcHJvamVjdC9tYmVkX3Byb2dyYW0ucHk=) | `100.00% <100.00%> (ø)` | |


Patch:
diff --git a/news/169.bugfix b/news/169.bugfix
new file mode 100644
index 0000000..78b6135
--- /dev/null
+++ b/news/169.bugfix
@@ -0,0 +1,1 @@
+Support use of user@host:directory syntax with the import subcommand.
diff --git a/src/mbed_tools/project/mbed_program.py b/src/mbed_tools/project/mbed_program.py
index d095e5b..c3a9536 100644
--- a/src/mbed_tools/project/mbed_program.py
+++ b/src/mbed_tools/project/mbed_program.py
@@ -113,6 +113,9 @@ def parse_url(name_or_url: str) -> Dict[str, str]:
     url_obj = urlparse(name_or_url)
     if url_obj.hostname:
         url = url_obj.geturl()
+    elif ":" in name_or_url.split("/", maxsplit=1)[0]:
+        # If non-standard and no slashes before first colon, git will recognize as scp ssh syntax
+        url = name_or_url
     else:
         url = f"https://github.com/armmbed/{url_obj.path}"
     # We need to create a valid directory name from the url path section.


Test patch:
diff --git a/tests/project/test_mbed_program.py b/tests/project/test_mbed_program.py
index 7f700f0..be83aa9 100644
--- a/tests/project/test_mbed_program.py
+++ b/tests/project/test_mbed_program.py
@@ -127,6 +127,12 @@ class TestParseURL(TestCase):
         self.assertEqual(data["url"], url)
         self.assertEqual(data["dst_path"], "mbed-os-example-numskull")
 
+    def test_creates_valid_dst_dir_from_ssh_url(self):
+        url = "git@superversioncontrol:superorg/mbed-os-example-numskull"
+        data = parse_url(url)
+        self.assertEqual(data["url"], url)
+        self.assertEqual(data["dst_path"], "mbed-os-example-numskull")
+
 
 class TestFindProgramRoot(TestCase):
     @patchfs