Skip to content

Feature: Improve awareess about current path and current program/project #780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 12, 2018
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
8 changes: 7 additions & 1 deletion mbed/mbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,9 @@ def isurl(cls, url):

@classmethod
def isinsecure(cls, url):
path = re.sub(r'^(.+)[#?].*$', r'\1', url)
if os.path.isdir(path): # local paths are secure
return False
up = urlparse(url)
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])

Expand Down Expand Up @@ -3344,7 +3347,10 @@ def main():
try:
very_verbose = pargs.very_verbose
verbose = very_verbose or pargs.verbose
info('Working path \"%s\" (%s)' % (getcwd(), Repo.pathtype(cwd_root)))
pathtype = Repo.pathtype(cwd_root)
action('Working path \"%s\" (%s)' % (cwd_root, pathtype))
if pathtype != "program":
action('Program path \"%s\"' % Program(cwd_root).path)
status = pargs.command(pargs)
except ProcessException as e:
error(
Expand Down
2 changes: 2 additions & 0 deletions test/add_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def test_add(mbed, testrepos):
popen(['python', mbed, 'add', test3, "-vv"])

assertls(mbed, 'test1', [
"[mbed]",
"test1",
"|- test2",
"| `- test3",
Expand All @@ -37,6 +38,7 @@ def test_import_after_add(mbed, testrepos):
popen(['python', mbed, 'import', test1, 'testimport', "-vv"])

assertls(mbed, 'testimport', [
"[mbed]",
"testimport",
"|- test2",
"| `- test3",
Expand Down
1 change: 1 addition & 0 deletions test/import_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def test_import(mbed, testrepos):
popen(['python', mbed, 'import', test1, 'testimport'])

assertls(mbed, 'testimport', [
"[mbed]",
"testimport",
"`- test2",
" `- test3",
Expand Down
1 change: 1 addition & 0 deletions test/ls_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# Tests 'mbed ls' and provides sanity check of test framework
def test_ls(mbed, testrepos):
assertls(mbed, 'test1', [
"[mbed]",
"test1",
"`- test2",
" `- test3",
Expand Down
2 changes: 2 additions & 0 deletions test/remove_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def test_remove(mbed, testrepos):
popen(['python', mbed, 'remove', 'test2'])

assertls(mbed, 'test1', [
"[mbed]",
"test1",
])

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

assertls(mbed, 'testimport', [
"[mbed]",
"testimport",
])
3 changes: 3 additions & 0 deletions test/sync_update_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_sync_update_remove(mbed, testrepos):
popen(['python', mbed, 'update', '-vv'])

assertls(mbed, 'testimport', [
"[mbed]",
"testimport",
"`- test2",
])
Expand All @@ -73,6 +74,7 @@ def test_sync_update_add(mbed, testrepos):
popen(['python', mbed, 'update', '-vv'])

assertls(mbed, 'testimport', [
"[mbed]",
"testimport",
"`- test2",
" |- test3",
Expand All @@ -99,6 +101,7 @@ def test_sync_update_move(mbed, testrepos):
popen(['python', mbed, 'update', '-vv'])

assertls(mbed, 'testimport', [
"[mbed]",
"testimport",
"`- test2",
" `- testmove",
Expand Down