Set a custom workspace for use
(path=None)
| 47 | |
| 48 | |
| 49 | def set_workspace(path=None): |
| 50 | """Set a custom workspace for use""" |
| 51 | |
| 52 | if not Settings.InstaPy_is_running: |
| 53 | if path: |
| 54 | path = verify_workspace_name(path) |
| 55 | workspace_is_new = differ_paths(WORKSPACE["path"], path) |
| 56 | if workspace_is_new: |
| 57 | update_workspace(path) |
| 58 | update_locations() |
| 59 | message = 'Custom workspace set: "{}" :]'.format(path) |
| 60 | highlight_print( |
| 61 | Settings.profile["name"], |
| 62 | message, |
| 63 | "workspace", |
| 64 | "info", |
| 65 | Settings.logger, |
| 66 | ) |
| 67 | |
| 68 | else: |
| 69 | message = "Given workspace path is identical as current :/" |
| 70 | highlight_print( |
| 71 | Settings.profile["name"], |
| 72 | message, |
| 73 | "workspace", |
| 74 | "info", |
| 75 | Settings.logger, |
| 76 | ) |
| 77 | |
| 78 | else: |
| 79 | message = "No any custom workspace provided.\t~using existing.." |
| 80 | highlight_print( |
| 81 | Settings.profile["name"], message, "workspace", "info", Settings.logger |
| 82 | ) |
| 83 | |
| 84 | else: |
| 85 | message = ( |
| 86 | "Sorry! You can't change workspace after" |
| 87 | " InstaPy has started :>\t~using existing.." |
| 88 | ) |
| 89 | highlight_print( |
| 90 | Settings.profile["name"], message, "workspace", "info", Settings.logger |
| 91 | ) |
| 92 | |
| 93 | |
| 94 | def update_workspace(latest_path): |
no test coverage detected