feat/workspace-tmux-remove #3

Merged
waylon merged 9 commits from feat/workspace-tmux-remove into main 2025-11-26 12:46:09 -06:00
2 changed files with 9 additions and 17 deletions
Showing only changes of commit f51701818a - Show all commits

View file

@ -75,10 +75,10 @@ select = [
"RSE", # flake8-raise "RSE", # flake8-raise
"RET", # flake8-return "RET", # flake8-return
# "SLF", # flake8-self # "SLF", # flake8-self
# "SIM", # flake8-simplify "SIM", # flake8-simplify
"TID", # flake8-tidy-imports "TID", # flake8-tidy-imports
"TCH", # flake8-type-checking "TCH", # flake8-type-checking
# "INT", # flake8-gettext "INT", # flake8-gettext
"ARG", # flake8-unused-arguments "ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib "PTH", # flake8-use-pathlib
"ERA", # eradicate "ERA", # eradicate

View file

@ -838,8 +838,7 @@ def remove_workspace(
problems.append(f"{wt.name}: dirty working tree on '{branch}'") problems.append(f"{wt.name}: dirty working tree on '{branch}'")
# Only care about "unpushed commits" if the branch is NOT integrated into main. # Only care about "unpushed commits" if the branch is NOT integrated into main.
if repo is not None and branch != "?" and not integrated: if repo is not None and branch != "?" and not integrated and has_unpushed_commits(wt):
if has_unpushed_commits(wt):
problems.append(f"{wt.name}: unpushed commits on '{branch}'") problems.append(f"{wt.name}: unpushed commits on '{branch}'")
if problems and not force: if problems and not force:
console.print( console.print(
@ -968,12 +967,7 @@ def choose_files_for_wip(repo_path: Path, changes: List[Tuple[str, str]]) -> Lis
return [] return []
# iterfzf may return a single string or list depending on version; # iterfzf may return a single string or list depending on version;
# normalize to list of strings. # normalize to list of strings.
if isinstance(selected, str): return [selected] if isinstance(selected, str) else list(selected)
selected_files = [selected]
else:
selected_files = list(selected)
return selected_files
@app.command("wip") @app.command("wip")
@ -1480,8 +1474,7 @@ def create_if_needed_and_attach(
return r.returncode == 0 return r.returncode == 0
# Inside tmux # Inside tmux
if not session_exists(session_name): if not session_exists(session_name) and not create_detached_session(session_name, path_name, start_mode):
if not create_detached_session(session_name, path_name, start_mode):
return False return False
r = run_tmux(["switch-client", "-t", session_name]) r = run_tmux(["switch-client", "-t", session_name])
@ -1618,8 +1611,7 @@ def tmux_cli_remove(
tmux_sessions = [ tmux_sessions = [
session for session in get_tmux_sessions() if session.startswith("ω") session for session in get_tmux_sessions() if session.startswith("ω")
] ]
if not dry_run: if not dry_run and not Confirm.ask(
if not Confirm.ask(
f"Are you sure you want to remove all tmux sessions?\n* {'\n* '.join(tmux_sessions)}\n", f"Are you sure you want to remove all tmux sessions?\n* {'\n* '.join(tmux_sessions)}\n",
default=False, default=False,
): ):