Skip to content

Commit ae35417

Browse files
Merge pull request #780 from screamerbg/feature-show-workdir
Feature: Improve awareess about current path and current program/project
2 parents e993263 + 04e7fbc commit ae35417

File tree

6 files changed

+16
-1
lines changed

6 files changed

+16
-1
lines changed

mbed/mbed.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,9 @@ def isurl(cls, url):
11331133

11341134
@classmethod
11351135
def isinsecure(cls, url):
1136+
path = re.sub(r'^(.+)[#?].*$', r'\1', url)
1137+
if os.path.isdir(path): # local paths are secure
1138+
return False
11361139
up = urlparse(url)
11371140
return (not up) or (up.scheme and up.scheme not in ['http', 'https', 'ssh', 'git']) or (up.port and int(up.port) not in [22, 80, 443])
11381141

@@ -3344,7 +3347,10 @@ def main():
33443347
try:
33453348
very_verbose = pargs.very_verbose
33463349
verbose = very_verbose or pargs.verbose
3347-
info('Working path \"%s\" (%s)' % (getcwd(), Repo.pathtype(cwd_root)))
3350+
pathtype = Repo.pathtype(cwd_root)
3351+
action('Working path \"%s\" (%s)' % (cwd_root, pathtype))
3352+
if pathtype != "program":
3353+
action('Program path \"%s\"' % Program(cwd_root).path)
33483354
status = pargs.command(pargs)
33493355
except ProcessException as e:
33503356
error(

test/add_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def test_add(mbed, testrepos):
2020
popen(['python', mbed, 'add', test3, "-vv"])
2121

2222
assertls(mbed, 'test1', [
23+
"[mbed]",
2324
"test1",
2425
"|- test2",
2526
"| `- test3",
@@ -37,6 +38,7 @@ def test_import_after_add(mbed, testrepos):
3738
popen(['python', mbed, 'import', test1, 'testimport', "-vv"])
3839

3940
assertls(mbed, 'testimport', [
41+
"[mbed]",
4042
"testimport",
4143
"|- test2",
4244
"| `- test3",

test/import_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def test_import(mbed, testrepos):
1818
popen(['python', mbed, 'import', test1, 'testimport'])
1919

2020
assertls(mbed, 'testimport', [
21+
"[mbed]",
2122
"testimport",
2223
"`- test2",
2324
" `- test3",

test/ls_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# Tests 'mbed ls' and provides sanity check of test framework
1616
def test_ls(mbed, testrepos):
1717
assertls(mbed, 'test1', [
18+
"[mbed]",
1819
"test1",
1920
"`- test2",
2021
" `- test3",

test/remove_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def test_remove(mbed, testrepos):
1818
popen(['python', mbed, 'remove', 'test2'])
1919

2020
assertls(mbed, 'test1', [
21+
"[mbed]",
2122
"test1",
2223
])
2324

@@ -30,5 +31,6 @@ def test_import_after_remove(mbed, testrepos):
3031
popen(['python', mbed, 'import', test1, 'testimport'])
3132

3233
assertls(mbed, 'testimport', [
34+
"[mbed]",
3335
"testimport",
3436
])

test/sync_update_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def test_sync_update_remove(mbed, testrepos):
5151
popen(['python', mbed, 'update', '-vv'])
5252

5353
assertls(mbed, 'testimport', [
54+
"[mbed]",
5455
"testimport",
5556
"`- test2",
5657
])
@@ -73,6 +74,7 @@ def test_sync_update_add(mbed, testrepos):
7374
popen(['python', mbed, 'update', '-vv'])
7475

7576
assertls(mbed, 'testimport', [
77+
"[mbed]",
7678
"testimport",
7779
"`- test2",
7880
" |- test3",
@@ -99,6 +101,7 @@ def test_sync_update_move(mbed, testrepos):
99101
popen(['python', mbed, 'update', '-vv'])
100102

101103
assertls(mbed, 'testimport', [
104+
"[mbed]",
102105
"testimport",
103106
"`- test2",
104107
" `- testmove",

0 commit comments

Comments
 (0)