Skip to content

Commit

Permalink
!squash
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Jan 4, 2025
1 parent 0d73f64 commit d26f28b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/tmuxp/cli/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ def command_convert(
if answer_yes:
with open(newfile, "w", encoding=locale.getpreferredencoding(False)) as buf:
buf.write(new_workspace)
print(f"New workspace file saved to <{newfile}>.") # NOQA: T201 RUF100
18 changes: 14 additions & 4 deletions src/tmuxp/cli/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,32 @@ def command_freeze(

if not session:
raise exc.SessionNotFound
except TmuxpException:
except TmuxpException as e:
print(e) # NOQA: T201 RUF100
return

frozen_workspace = freezer.freeze(session)
workspace = freezer.inline(frozen_workspace)
configparser = ConfigReader(workspace)

if not args.quiet:
pass
print( # NOQA: T201 RUF100
"---------------------------------------------------------------"
"\n"
"Freeze does its best to snapshot live tmux sessions.\n",
)
if not (
args.answer_yes
or prompt_yes_no(
"The new workspace will require adjusting afterwards. Save workspace file?",
)
):
if not args.quiet:
pass
print( # NOQA: T201 RUF100
"tmuxp has examples in JSON and YAML format at "
"<http://tmuxp.git-pull.com/examples.html>\n"
"View tmuxp docs at <http://tmuxp.git-pull.com/>.",
)
sys.exit()

dest = args.save_to
Expand All @@ -151,6 +160,7 @@ def command_freeze(
default=save_to,
)
if not args.force and os.path.exists(dest_prompt):
print(f"{dest_prompt} exists. Pick a new filename.") # NOQA: T201 RUF100
continue

dest = dest_prompt
Expand Down Expand Up @@ -204,4 +214,4 @@ def extract_workspace_format(
buf.write(workspace)

if not args.quiet:
pass
print(f"Saved to {dest}.") # NOQA: T201 RUF100

0 comments on commit d26f28b

Please sign in to comment.