worktree-aid 1.2__tar.gz → 1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: worktree-aid
3
- Version: 1.2
3
+ Version: 1.3
4
4
  Summary: Linux command line tool to aid creating, switching, and removing git worktrees
5
5
  Author-email: Mark Blakeney <mark.blakeney@bullet-systems.net>
6
6
  License-Expression: GPL-3.0-or-later
@@ -100,7 +100,7 @@ aliases: a
100
100
  ### Command `rm`
101
101
 
102
102
  ```
103
- usage: wt rm [-h] [-k] [-f] [worktree]
103
+ usage: wt rm [-h] [-k] [-f] [worktree ...]
104
104
 
105
105
  Remove worktree + branch.
106
106
 
@@ -187,8 +187,9 @@ $ yay -S worktree-aid # or your preferred AUR helper
187
187
  ```
188
188
 
189
189
  You also need to install a fuzzy finder program such as [`fzf`][fzf] which is
190
- the default used by `worktree-aid`. See [fuzzy finder installation
191
- instructions](#fuzzy-finder-integration) for possible alternatives.
190
+ the default used by `worktree-aid`. See [fuzzy finder
191
+ installation](#fuzzy-finder-integration) instructions for possible
192
+ alternatives.
192
193
 
193
194
  ## Setup
194
195
 
@@ -233,11 +234,7 @@ The above sets `-R` (for relative display of worktree directories) as default fo
233
234
  `wt` command.
234
235
 
235
236
  The following options are sensible candidates to set as default options:
236
-
237
- - `-B/--basedir`,
238
- - `-R/--relative`,
239
- - `-U/--no-user`,
240
- - `-F/--fuzzy`.
237
+ `-B/--basedir`, `-R/--relative`, `-U/--no-user`, `-F/--fuzzy`.
241
238
 
242
239
  ## Worktree Base Directory
243
240
 
@@ -246,9 +243,12 @@ worktrees. It is set to a default as below but you can change this to any
246
243
  directory you like. It can be absolute or relative where relative paths are
247
244
  relative to base repository directory.
248
245
 
249
- - Default is `-B ../worktrees/{repo}` which is the same as the [Zed] editor uses.
250
- - E.g. can use `-B ../{repo}.worktrees` which is same as [VS Code] uses.
251
- - E.g. can use `-B ~/worktrees/{repo}` to put all worktrees in a subdirectory of your home directory.
246
+ - Default is `-B ../worktrees/{repo}` which is the same as the [Zed] editor
247
+ uses by default.
248
+ - E.g. can use `-B ../{repo}.worktrees` which is same as [VS Code] uses by
249
+ default.
250
+ - E.g. can use `-B ~/worktrees/{repo}` to put all worktrees in a subdirectory
251
+ of your home directory.
252
252
 
253
253
  The following place-markers can be used in the definition of the base directory:
254
254
 
@@ -256,8 +256,8 @@ The following place-markers can be used in the definition of the base directory:
256
256
  - `{user}`: Substituted with the name of the user.
257
257
  - `{home}`: Substituted with the home directory of the user (also can use `~` at start of a path).
258
258
 
259
- Most likely if you want to set a custom basedir then you will set `-B` as a
260
- [default option](#default-options).
259
+ Most likely if you want to set a custom base directory then you will set `-B`
260
+ as a [default option](#default-options).
261
261
 
262
262
  ## Display as Relative Worktree Directories
263
263
 
@@ -268,10 +268,10 @@ can enable it in `worktree-aid` by adding the `-R/--relative` option, e.g:
268
268
 
269
269
  ```sh
270
270
  $ wt l
271
- ../development 9796714 [development]
272
- ../milestone1 bc921b8 [milestone1]
273
- ../test e6d965a [test]
274
- . f76b8e0 [main]
271
+ ../worktrees/worktree-aid/development 9796714 [development]
272
+ ../worktrees/worktree-aid/milestone1 bc921b8 [milestone1]
273
+ ../worktrees/worktree-aid/test e6d965a [test]
274
+ f76b8e0 [main]
275
275
  ```
276
276
 
277
277
  Most likely you will want to set `-R` as a [default option](#default-options).
@@ -88,7 +88,7 @@ aliases: a
88
88
  ### Command `rm`
89
89
 
90
90
  ```
91
- usage: wt rm [-h] [-k] [-f] [worktree]
91
+ usage: wt rm [-h] [-k] [-f] [worktree ...]
92
92
 
93
93
  Remove worktree + branch.
94
94
 
@@ -175,8 +175,9 @@ $ yay -S worktree-aid # or your preferred AUR helper
175
175
  ```
176
176
 
177
177
  You also need to install a fuzzy finder program such as [`fzf`][fzf] which is
178
- the default used by `worktree-aid`. See [fuzzy finder installation
179
- instructions](#fuzzy-finder-integration) for possible alternatives.
178
+ the default used by `worktree-aid`. See [fuzzy finder
179
+ installation](#fuzzy-finder-integration) instructions for possible
180
+ alternatives.
180
181
 
181
182
  ## Setup
182
183
 
@@ -221,11 +222,7 @@ The above sets `-R` (for relative display of worktree directories) as default fo
221
222
  `wt` command.
222
223
 
223
224
  The following options are sensible candidates to set as default options:
224
-
225
- - `-B/--basedir`,
226
- - `-R/--relative`,
227
- - `-U/--no-user`,
228
- - `-F/--fuzzy`.
225
+ `-B/--basedir`, `-R/--relative`, `-U/--no-user`, `-F/--fuzzy`.
229
226
 
230
227
  ## Worktree Base Directory
231
228
 
@@ -234,9 +231,12 @@ worktrees. It is set to a default as below but you can change this to any
234
231
  directory you like. It can be absolute or relative where relative paths are
235
232
  relative to base repository directory.
236
233
 
237
- - Default is `-B ../worktrees/{repo}` which is the same as the [Zed] editor uses.
238
- - E.g. can use `-B ../{repo}.worktrees` which is same as [VS Code] uses.
239
- - E.g. can use `-B ~/worktrees/{repo}` to put all worktrees in a subdirectory of your home directory.
234
+ - Default is `-B ../worktrees/{repo}` which is the same as the [Zed] editor
235
+ uses by default.
236
+ - E.g. can use `-B ../{repo}.worktrees` which is same as [VS Code] uses by
237
+ default.
238
+ - E.g. can use `-B ~/worktrees/{repo}` to put all worktrees in a subdirectory
239
+ of your home directory.
240
240
 
241
241
  The following place-markers can be used in the definition of the base directory:
242
242
 
@@ -244,8 +244,8 @@ The following place-markers can be used in the definition of the base directory:
244
244
  - `{user}`: Substituted with the name of the user.
245
245
  - `{home}`: Substituted with the home directory of the user (also can use `~` at start of a path).
246
246
 
247
- Most likely if you want to set a custom basedir then you will set `-B` as a
248
- [default option](#default-options).
247
+ Most likely if you want to set a custom base directory then you will set `-B`
248
+ as a [default option](#default-options).
249
249
 
250
250
  ## Display as Relative Worktree Directories
251
251
 
@@ -256,10 +256,10 @@ can enable it in `worktree-aid` by adding the `-R/--relative` option, e.g:
256
256
 
257
257
  ```sh
258
258
  $ wt l
259
- ../development 9796714 [development]
260
- ../milestone1 bc921b8 [milestone1]
261
- ../test e6d965a [test]
262
- . f76b8e0 [main]
259
+ ../worktrees/worktree-aid/development 9796714 [development]
260
+ ../worktrees/worktree-aid/milestone1 bc921b8 [milestone1]
261
+ ../worktrees/worktree-aid/test e6d965a [test]
262
+ f76b8e0 [main]
263
263
  ```
264
264
 
265
265
  Most likely you will want to set `-R` as a [default option](#default-options).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: worktree-aid
3
- Version: 1.2
3
+ Version: 1.3
4
4
  Summary: Linux command line tool to aid creating, switching, and removing git worktrees
5
5
  Author-email: Mark Blakeney <mark.blakeney@bullet-systems.net>
6
6
  License-Expression: GPL-3.0-or-later
@@ -100,7 +100,7 @@ aliases: a
100
100
  ### Command `rm`
101
101
 
102
102
  ```
103
- usage: wt rm [-h] [-k] [-f] [worktree]
103
+ usage: wt rm [-h] [-k] [-f] [worktree ...]
104
104
 
105
105
  Remove worktree + branch.
106
106
 
@@ -187,8 +187,9 @@ $ yay -S worktree-aid # or your preferred AUR helper
187
187
  ```
188
188
 
189
189
  You also need to install a fuzzy finder program such as [`fzf`][fzf] which is
190
- the default used by `worktree-aid`. See [fuzzy finder installation
191
- instructions](#fuzzy-finder-integration) for possible alternatives.
190
+ the default used by `worktree-aid`. See [fuzzy finder
191
+ installation](#fuzzy-finder-integration) instructions for possible
192
+ alternatives.
192
193
 
193
194
  ## Setup
194
195
 
@@ -233,11 +234,7 @@ The above sets `-R` (for relative display of worktree directories) as default fo
233
234
  `wt` command.
234
235
 
235
236
  The following options are sensible candidates to set as default options:
236
-
237
- - `-B/--basedir`,
238
- - `-R/--relative`,
239
- - `-U/--no-user`,
240
- - `-F/--fuzzy`.
237
+ `-B/--basedir`, `-R/--relative`, `-U/--no-user`, `-F/--fuzzy`.
241
238
 
242
239
  ## Worktree Base Directory
243
240
 
@@ -246,9 +243,12 @@ worktrees. It is set to a default as below but you can change this to any
246
243
  directory you like. It can be absolute or relative where relative paths are
247
244
  relative to base repository directory.
248
245
 
249
- - Default is `-B ../worktrees/{repo}` which is the same as the [Zed] editor uses.
250
- - E.g. can use `-B ../{repo}.worktrees` which is same as [VS Code] uses.
251
- - E.g. can use `-B ~/worktrees/{repo}` to put all worktrees in a subdirectory of your home directory.
246
+ - Default is `-B ../worktrees/{repo}` which is the same as the [Zed] editor
247
+ uses by default.
248
+ - E.g. can use `-B ../{repo}.worktrees` which is same as [VS Code] uses by
249
+ default.
250
+ - E.g. can use `-B ~/worktrees/{repo}` to put all worktrees in a subdirectory
251
+ of your home directory.
252
252
 
253
253
  The following place-markers can be used in the definition of the base directory:
254
254
 
@@ -256,8 +256,8 @@ The following place-markers can be used in the definition of the base directory:
256
256
  - `{user}`: Substituted with the name of the user.
257
257
  - `{home}`: Substituted with the home directory of the user (also can use `~` at start of a path).
258
258
 
259
- Most likely if you want to set a custom basedir then you will set `-B` as a
260
- [default option](#default-options).
259
+ Most likely if you want to set a custom base directory then you will set `-B`
260
+ as a [default option](#default-options).
261
261
 
262
262
  ## Display as Relative Worktree Directories
263
263
 
@@ -268,10 +268,10 @@ can enable it in `worktree-aid` by adding the `-R/--relative` option, e.g:
268
268
 
269
269
  ```sh
270
270
  $ wt l
271
- ../development 9796714 [development]
272
- ../milestone1 bc921b8 [milestone1]
273
- ../test e6d965a [test]
274
- . f76b8e0 [main]
271
+ ../worktrees/worktree-aid/development 9796714 [development]
272
+ ../worktrees/worktree-aid/milestone1 bc921b8 [milestone1]
273
+ ../worktrees/worktree-aid/test e6d965a [test]
274
+ f76b8e0 [main]
275
275
  ```
276
276
 
277
277
  Most likely you will want to set `-R` as a [default option](#default-options).
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "1.3",
3
+ "distance": 0,
4
+ "node": "g96636984d65e5c8842ec3d42da1b2c72bda998fd",
5
+ "dirty": false,
6
+ "branch": "main",
7
+ "node_date": "2026-08-03"
8
+ }
@@ -273,12 +273,15 @@ class Trees:
273
273
  @classmethod
274
274
  def remove_worktree(cls, name: str, args: Namespace) -> Path | None:
275
275
  "Remove the worktree and branch with the given name"
276
- if name:
277
- if not (tree := cls.get_tree(name)):
278
- sys.exit(f'error: no worktree found with name "{name}".')
279
- else:
280
- # If no name is given, remove the current worktree and branch
281
- tree = cls.current
276
+ if not (tree := cls.get_tree(name)):
277
+ sys.exit(f'error: no worktree found with name "{name}".')
278
+
279
+ if tree == cls.toplevel:
280
+ print(
281
+ f'warning: not removing top-level worktree "{tree.path}"',
282
+ file=sys.stderr,
283
+ )
284
+ return None
282
285
 
283
286
  # Change to the top-level worktree directory before deleting a worktree
284
287
  # and/or branch, in case the current directory is removed.
@@ -472,8 +475,7 @@ class rm_:
472
475
  )
473
476
  parser.add_argument(
474
477
  'worktree',
475
- default='',
476
- nargs='?',
478
+ nargs='*',
477
479
  help='worktree + branch name to remove. If not specified then '
478
480
  'fuzzy finder will prompt with a list of worktrees, with the '
479
481
  'current worktree as the default selection.',
@@ -482,13 +484,17 @@ class rm_:
482
484
  @staticmethod
483
485
  def run(args: Namespace) -> str | None:
484
486
  Trees.fetch(args)
485
- if not (name := args.worktree):
486
- if not (path := Trees.prompt(args)):
487
- return None
488
- name = path.name
487
+ retpath = None
488
+ for name in args.worktree or ['']:
489
+ if not name:
490
+ if not (path := Trees.prompt(args)):
491
+ return None
492
+ name = path.name
489
493
 
490
- path = Trees.remove_worktree(name, args)
491
- return str(path) if path else None
494
+ if path := Trees.remove_worktree(name, args):
495
+ retpath = path
496
+
497
+ return str(retpath) if retpath else None
492
498
 
493
499
 
494
500
  # COMMAND
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "1.2",
3
- "distance": 0,
4
- "node": "gcb78b4dc270eb62209b736dedbcf8e12ad2591ec",
5
- "dirty": false,
6
- "branch": "main",
7
- "node_date": "2026-08-02"
8
- }
File without changes
File without changes
File without changes
File without changes