MCPcopy
hub / github.com/InstaPy/InstaPy / set_workspace

Function set_workspace

instapy/file_manager.py:49–91  ·  view source on GitHub ↗

Set a custom workspace for use

(path=None)

Source from the content-addressed store, hash-verified

47
48
49def 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
94def update_workspace(latest_path):

Callers 1

quickstart.pyFile · 0.90

Calls 5

verify_workspace_nameFunction · 0.85
differ_pathsFunction · 0.85
update_workspaceFunction · 0.85
update_locationsFunction · 0.85
highlight_printFunction · 0.85

Tested by

no test coverage detected