Skip to content

Commit 0d3034f

Browse files
committed
refactor(cli): Move config -> workspace renaming
1 parent 4b4c838 commit 0d3034f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/tmuxp/cli/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ def command_convert(
7272
buf = open(newfile, "w")
7373
buf.write(new_workspace)
7474
buf.close()
75-
print(f"New config saved to <{newfile}>.")
75+
print(f"New workspace file saved to <{newfile}>.")

src/tmuxp/cli/freeze.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ def command_freeze(
110110
print(e)
111111
return
112112

113-
sconf = freezer.freeze(session)
114-
newconfig = freezer.inline(sconf)
115-
configparser = ConfigReader(newconfig)
113+
frozen_workspace = freezer.freeze(session)
114+
workspace = freezer.inline(frozen_workspace)
115+
configparser = ConfigReader(workspace)
116116

117117
if not args.quiet:
118118
print(
@@ -140,7 +140,8 @@ def command_freeze(
140140
os.path.join(
141141
get_workspace_dir(),
142142
"{}.{}".format(
143-
sconf.get("session_name"), args.workspace_format or "yaml"
143+
frozen_workspace.get("session_name"),
144+
args.workspace_format or "yaml",
144145
),
145146
)
146147
)
@@ -183,18 +184,18 @@ def extract_workspace_format(
183184
)
184185

185186
if workspace_format == "yaml":
186-
newconfig = configparser.dump(
187+
workspace = configparser.dump(
187188
format="yaml", indent=2, default_flow_style=False, safe=True
188189
)
189190
elif workspace_format == "json":
190-
newconfig = configparser.dump(format="json", indent=2)
191+
workspace = configparser.dump(format="json", indent=2)
191192

192193
if args.answer_yes or prompt_yes_no("Save to %s?" % dest):
193194
destdir = os.path.dirname(dest)
194195
if not os.path.isdir(destdir):
195196
os.makedirs(destdir)
196197
buf = open(dest, "w")
197-
buf.write(newconfig)
198+
buf.write(workspace)
198199
buf.close()
199200

200201
if not args.quiet:

0 commit comments

Comments
 (0)