skilleter-thingy 0.1.7__py3-none-any.whl → 0.1.9__py3-none-any.whl

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.

Potentially problematic release.


This version of skilleter-thingy might be problematic. Click here for more details.

@@ -102,7 +102,7 @@ class GitReviewError(BaseException):
102
102
  def error(msg, status=1):
103
103
  """ Report an error """
104
104
 
105
- sys.stderr.write('%s\n' % msg)
105
+ sys.stderr.write(f'{msg}\n')
106
106
  sys.exit(status)
107
107
 
108
108
  ################################################################################
@@ -254,7 +254,7 @@ class GitReview():
254
254
  self.__update_changed_files()
255
255
 
256
256
  if not self.changed_files:
257
- msg = ['There are no changes between %s and ' % args.commits[0]]
257
+ msg = [f'There are no changes between {args.commits[0]} and ']
258
258
 
259
259
  if args.commits[1]:
260
260
  msg.append(args.commits[1])
@@ -262,7 +262,7 @@ class GitReview():
262
262
  msg.append('local files')
263
263
 
264
264
  if args.paths:
265
- msg.append(' in the %s directory' % args.paths[0])
265
+ msg.append(f' in the {args.paths[0]} directory')
266
266
 
267
267
  raise GitReviewError(''.join(msg))
268
268
 
@@ -1389,7 +1389,7 @@ def parse_command_line():
1389
1389
  else:
1390
1390
  colour.error(f'[RED:ERROR]: Multiple commits match {entry}')
1391
1391
  else:
1392
- colour.error(f'[RED:ERROR] {entry} is not a valid commit ID' % entry)
1392
+ colour.error(f'[RED:ERROR] {entry} is not a valid commit ID')
1393
1393
 
1394
1394
  # Things work easier if we always have two commits to compare
1395
1395
 
@@ -141,6 +141,14 @@ def error(msg, status=1):
141
141
 
142
142
  ################################################################################
143
143
 
144
+ def verbose(args, msg):
145
+ """Output a message to stderr if running verbosely"""
146
+
147
+ if args.verbose:
148
+ colour.write(f'>>>{msg}', stream=sys.stderr)
149
+
150
+ ################################################################################
151
+
144
152
  def absolute_repo_path(args, relative_path=''):
145
153
  """Given a path relative to the multigit configuration file, return
146
154
  the absolute path thereto"""
@@ -149,6 +157,14 @@ def absolute_repo_path(args, relative_path=''):
149
157
 
150
158
  ################################################################################
151
159
 
160
+ def relative_repo_path(args, relative_path=''):
161
+ """Given a path relative to the multigit configuration file, return
162
+ the relative path from the current directory"""
163
+
164
+ return os.path.relpath(absolute_repo_path(args, relative_path))
165
+
166
+ ################################################################################
167
+
152
168
  def find_configuration(default_config_file):
153
169
  """If the configuration file name has path elements, try and read it, otherwise
154
170
  search up the directory tree looking for the configuration file.
@@ -432,9 +448,13 @@ def mg_dir(args, config, console):
432
448
  _ = console
433
449
  _ = config
434
450
 
451
+ verbose(args, f'dir: Parameters: {", ".join(args.parameters)}')
452
+
435
453
  if len(args.parameters) > 1:
436
454
  error('The +dir command takes no more than one parameter - the name of the working tree to search for')
437
455
 
456
+ # TODO: mg_dir _should_ use these options
457
+
438
458
  if args.modified or args.branched or args.tag or args.subdirectories:
439
459
  error('The "--tag", "--modified" "--sub", and "--branched" options cannot be used with the "dir" subcommand')
440
460
 
@@ -443,29 +463,25 @@ def mg_dir(args, config, console):
443
463
 
444
464
  if args.parameters:
445
465
  location = []
446
- wild_prefix_location = []
447
466
  wild_location = []
448
467
 
449
468
  search_name = args.parameters[0]
450
469
 
451
- # Search for exact matches, matches if prefixed by '*' or prefixed and suffixed with '*'
452
- # unless it already contains '*'
470
+ # Search for exact matches, or matches that contain the search term if it
471
+ # doesn't already contain a wildcard
453
472
 
454
473
  for repo in select_git_repos(args, config):
455
474
  if fnmatch.fnmatch(repo['repo name'], search_name):
456
475
  location.append(repo.name)
457
476
 
458
477
  elif '*' not in search_name:
459
- if fnmatch.fnmatch(repo['repo name'], f'*{search_name}'):
460
- wild_prefix_location.append(repo.name)
461
-
462
- elif fnmatch.fnmatch(repo['repo name'], f'*{search_name}*'):
478
+ if fnmatch.fnmatch(repo['repo name'], f'*{search_name}*'):
463
479
  wild_location.append(repo.name)
464
480
 
465
481
  # Look for a single exact match, a prefix with '*' match or prefix+suffix
466
482
 
467
483
  destination = None
468
- for destinations in (location, wild_prefix_location, wild_location):
484
+ for destinations in (location, wild_location):
469
485
  if len(destinations) == 1:
470
486
  destination = destinations
471
487
  break
@@ -476,11 +492,7 @@ def mg_dir(args, config, console):
476
492
  if not destination:
477
493
  error(f'No matches with [BLUE:{search_name}]')
478
494
 
479
- if len(destination) > 1:
480
- dest_list = "\n\t".join([os.path.relpath(d) for d in destination])
481
- error(f'Multiple matches with [BLUE:{search_name}]: \n\t{dest_list}')
482
-
483
- colour.write(absolute_repo_path(args, destination[0]))
495
+ colour.write("\n".join([relative_repo_path(args, d) for d in destination]))
484
496
 
485
497
  else:
486
498
  colour.write(os.path.dirname(args.configuration_file))
@@ -578,82 +590,83 @@ def parse_command_line():
578
590
 
579
591
  args = Arguments()
580
592
 
581
- # Expand arguments so that, for instance '-dv' is parsed as '-d -v'
582
-
583
- argv = []
593
+ # Parse the command line, setting options in the args dataclass appropriately
584
594
 
585
- for arg in sys.argv:
586
- if arg[0] != '-' or arg.startswith('--'):
587
- argv.append(arg)
588
- else:
589
- for c in arg[1:]:
590
- argv.append('-' + c)
595
+ arg_list = sys.argv[1:]
591
596
 
592
- # Parse the command line, setting options in the args dataclass appropriately
597
+ while arg_list and arg_list[0].startswith('-'):
598
+ # Split a parameter into a list, so --x becomes [x] but -xyz becomes [x, y, z]
593
599
 
594
- i = 1
595
- while i < len(argv):
596
- param = argv[i]
600
+ arg_entry = arg_list.pop(0)
601
+ if arg_entry.startswith('--'):
602
+ params = [arg_entry[2:]]
603
+ else:
604
+ params = list(arg_entry[1:])
597
605
 
598
- if param in ('--verbose', '-v'):
599
- args.verbose = True
606
+ while params:
607
+ param = params.pop(0)
600
608
 
601
- elif param in ('--quiet', '-q'):
602
- args.quiet = True
609
+ if param in ('verbose', 'v'):
610
+ args.verbose = True
603
611
 
604
- elif param in ('--config', '-c'):
605
- try:
606
- i += 1
607
- args.default_configuration_file = argv[i]
608
- except IndexError:
609
- error('--config - missing configuration file parameter')
612
+ elif param in ('quiet', 'q'):
613
+ args.quiet = True
610
614
 
611
- elif param in ('--repos', '-r'):
612
- try:
613
- i += 1
614
- args.repos.append(argv[i])
615
- except IndexError:
616
- error('--repos - missing repo parameter')
615
+ elif param in ('config', 'c'):
616
+ if params:
617
+ error('--config - missing configuration file parameter')
618
+ else:
619
+ try:
620
+ args.default_configuration_file = arg_list.pop(0)
621
+ except IndexError:
622
+ error('--config - missing configuration file parameter')
617
623
 
618
- elif param in ('--tag', '-t'):
619
- try:
620
- i += 1
621
- args.tag.append(argv[i])
622
- except IndexError:
623
- error('--tag - missing tag parameter')
624
+ elif param in ('repos', 'r'):
625
+ if params:
626
+ error('--repos - missing repo parameter')
627
+ try:
628
+ args.repos.append(arg_list.pop(0))
629
+ except IndexError:
630
+ error('--repos - missing repo parameter')
624
631
 
625
- elif param in ('--modified', '-m'):
626
- args.modified = True
632
+ elif param in ('tag', 't'):
633
+ if params:
634
+ error('--tag - missing tag parameter')
635
+ try:
636
+ args.tag.append(arg_list.pop(0))
637
+ except IndexError:
638
+ error('--tag - missing tag parameter')
627
639
 
628
- elif param in ('--branched', '-b'):
629
- args.branched = True
640
+ elif param in ('modified', 'm'):
641
+ args.modified = True
630
642
 
631
- elif param in ('--sub', '-s'):
632
- args.subdirectories = True
643
+ elif param in ('branched', 'b'):
644
+ args.branched = True
633
645
 
634
- elif param in ('--continue', '-C'):
635
- args.error_continue = True
646
+ elif param in ('sub', 's'):
647
+ args.subdirectories = True
636
648
 
637
- elif param in ('--help', '-h'):
638
- colour.write(HELP_INFO)
639
- sys.exit(0)
649
+ elif param in ('continue', 'C'):
650
+ args.error_continue = True
640
651
 
641
- elif param[0] == '-':
642
- error(f'Invalid option: "{param}"')
643
- else:
644
- break
652
+ elif param in ('help', 'h'):
653
+ colour.write(HELP_INFO)
654
+ sys.exit(0)
645
655
 
646
- i += 1
656
+ else:
657
+ error(f'Invalid option: "{param}"')
647
658
 
648
659
  # After the options, we either have a multigit command (prefixed with '+') or a git command
649
660
  # followed by parameter
650
661
 
651
662
  try:
652
- if argv[i][0] == '+':
653
- args.command = argv[i][1:]
663
+ command = arg_list.pop(0)
664
+
665
+ if command[0] == '+':
666
+ args.command = command[1:]
654
667
  args.internal_command = True
655
668
  else:
656
- args.command = argv[i]
669
+ args.command = command
657
670
  args.internal_command = False
658
671
 
659
672
  except IndexError:
@@ -661,7 +674,7 @@ def parse_command_line():
661
674
 
662
675
  # Save the command parameters
663
676
 
664
- args.parameters = argv[i+1:]
677
+ args.parameters = arg_list
665
678
 
666
679
  # Locate the configuration file
667
680
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: skilleter_thingy
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: A collection of useful utilities, mainly aimed at making Git more friendly
5
5
  Author-email: John Skilleter <john@skilleter.org.uk>
6
6
  Project-URL: Home, https://skilleter.org.uk
@@ -19,6 +19,7 @@ Requires-Dist: pygit2
19
19
  Requires-Dist: python-dateutil
20
20
  Requires-Dist: requests
21
21
  Requires-Dist: filetype
22
+ Dynamic: license-file
22
23
 
23
24
  # Thingy
24
25
 
@@ -103,7 +104,7 @@ Multigit supports a small list of subcommands, each of which are prefixed with a
103
104
 
104
105
  `+init` - Create or update the configuration file
105
106
 
106
- `+dir` - Given the name of a working tree, output the location within the multigit tree of that working tree if the name matches uniquely, or the name of the directory where the multigit configuration file resides if no parameter is specified.
107
+ `+dir NAME` - Given the name of a working tree, output relative path(s) to one or more matching working trees. If `NAME` does NOT contains wildcard characters (`*` or `?`) then matching takes place as if `*` were prefixed and appended to it, otherwise, the wildcards are used as specified. If `NAME` is not specified then the location of the directory where the multigit configuration file resides is output.
107
108
 
108
109
  `+config` - Print the name and location of the multigit configuration file.
109
110
 
@@ -15,7 +15,7 @@ skilleter_thingy/git_common.py,sha256=ZjNkvIBRDGNLFYwOu9FjeqdDKJdm0sndX5QATtmq29
15
15
  skilleter_thingy/git_hold.py,sha256=Zk6YUhr08znUOdpVJkJAt0rOtrCXnKE0NHoZzoaEEGo,4616
16
16
  skilleter_thingy/git_mr.py,sha256=g33FaRtJTbIQI0tfXv_a042YpGwtbg5fKw072aqjAdw,3086
17
17
  skilleter_thingy/git_parent.py,sha256=DLy38mo06R0YDyJWQjrP8pQS-qc7tvLYcn8unKqzEiQ,2774
18
- skilleter_thingy/git_review.py,sha256=e0yvDD9fIVhscnEP7hY26Od8VUbPEb7iMVMbY63Xjbc,52462
18
+ skilleter_thingy/git_review.py,sha256=Vmepd1qHPM9eHYE19KNO0UWJIYhGhlwPlVBjbgFZ2PM,52448
19
19
  skilleter_thingy/git_update.py,sha256=nw-bnDFrMi7yNf7P6gGF8gzmJUjXU5PhWhOYPgApcX4,14350
20
20
  skilleter_thingy/git_wt.py,sha256=Xm4VBBXMI4GxNtH3QvF-QL9rtvo4RrlWSbNQDFpGZu8,2954
21
21
  skilleter_thingy/gitcmp_helper.py,sha256=wutDHpBPOX8ZsXbsC5ApHxMY5tOKgD3P0eyFVs_mSAI,11214
@@ -24,7 +24,7 @@ skilleter_thingy/gl.py,sha256=9zbGpKxw6lX9RghLkdy-Q5sZlqtbB3uGFO04qTu1dH8,5954
24
24
  skilleter_thingy/gphotosync.py,sha256=M0yzt5IxCHezkCOQwz3Chn8oudY_M7PRffboIUFLedk,22477
25
25
  skilleter_thingy/linecount.py,sha256=ehTN6VD76i4U5k6dXuYoiqSRHI67_BP-bziklNAJSKY,4309
26
26
  skilleter_thingy/moviemover.py,sha256=QzUAWQzQ1AWWREIhl-VMaLo2h8MMhOekBnao5jGWV1s,4470
27
- skilleter_thingy/multigit.py,sha256=o_gW9vlPJ_uUNRxRYm92kBUl1pQKpt76xoVIBg6XaLo,27814
27
+ skilleter_thingy/multigit.py,sha256=zrn8kIa9gP5WJztWJURz7HNu90XAsecdAWTc2upU-jc,28519
28
28
  skilleter_thingy/photodupe.py,sha256=l0hbzSLb2Vk2ceteg-x9fHXCEE1uUuFo84hz5rsZUPA,4184
29
29
  skilleter_thingy/phototidier.py,sha256=BOu-cKHMivDlBqlRqv7sL3J6Ix1K2dxWWNcderldyZo,7818
30
30
  skilleter_thingy/py_audit.py,sha256=xJm5k5qyeA6ii8mODa4dOkmP8L1drv94UHuxR54RsIM,4384
@@ -60,9 +60,9 @@ skilleter_thingy/thingy/run.py,sha256=6SNKWF01fSxzB10GMU9ajraXYZqAL1w0PXkqjJdr1U
60
60
  skilleter_thingy/thingy/tfm_pane.py,sha256=oqy5zBzKwfbjbGqetbbhpKi4x5He7sl4qkmhUeqtdZc,19789
61
61
  skilleter_thingy/thingy/tidy.py,sha256=UWpBWuIMCE1UonLJErb41yW3RtpXrK_bt4Z4cZR-eDU,5910
62
62
  skilleter_thingy/thingy/venv_template.py,sha256=SsVNvSwojd8NnFeQaZPCRQYTNdwJRplpZpygbUEXRnY,1015
63
- skilleter_thingy-0.1.7.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
64
- skilleter_thingy-0.1.7.dist-info/METADATA,sha256=Rq3d_ivZOANFFtlWwG-FQo72gVMunqY4QAhKCpZpnKQ,29686
65
- skilleter_thingy-0.1.7.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
66
- skilleter_thingy-0.1.7.dist-info/entry_points.txt,sha256=u5ymS-KPljIGTnprV5yJsAjz7qgeT2BZ-Qo_Con_PFM,2145
67
- skilleter_thingy-0.1.7.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
68
- skilleter_thingy-0.1.7.dist-info/RECORD,,
63
+ skilleter_thingy-0.1.9.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
64
+ skilleter_thingy-0.1.9.dist-info/METADATA,sha256=XJJ2S92lPWLgy0mgs3jGptwlpJaQXE-zPUHD9AwoNU4,29873
65
+ skilleter_thingy-0.1.9.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
66
+ skilleter_thingy-0.1.9.dist-info/entry_points.txt,sha256=u5ymS-KPljIGTnprV5yJsAjz7qgeT2BZ-Qo_Con_PFM,2145
67
+ skilleter_thingy-0.1.9.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
68
+ skilleter_thingy-0.1.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5