skilleter-thingy 0.0.67__tar.gz → 0.0.69__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.
Potentially problematic release.
This version of skilleter-thingy might be problematic. Click here for more details.
- {skilleter_thingy-0.0.67/skilleter_thingy.egg-info → skilleter_thingy-0.0.69}/PKG-INFO +2 -2
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/pyproject.toml +1 -1
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/readable.py +53 -23
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69/skilleter_thingy.egg-info}/PKG-INFO +2 -2
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/LICENSE +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/README.md +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/setup.cfg +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/__init__.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/addpath.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/borger.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/box.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/console_colours.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/diskspacecheck.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/docker_purge.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/ffind.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/ggit.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/ggrep.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/git_br.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/git_ca.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/git_cleanup.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/git_co.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/git_common.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/git_hold.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/git_mr.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/git_parent.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/git_review.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/git_update.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/git_wt.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/gitcmp_helper.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/gitprompt.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/gl.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/gphotosync.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/linecount.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/moviemover.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/photodupe.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/phototidier.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/py_audit.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/remdir.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/rmdupe.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/rpylint.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/splitpics.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/strreplace.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/sysmon.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/tfm.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/tfparse.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/__init__.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/colour.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/dc_curses.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/dc_defaults.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/dc_util.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/dircolors.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/docker.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/files.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/git.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/git2.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/gitlab.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/path.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/popup.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/process.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/run.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/tfm_pane.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/tidy.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/venv_template.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/trimpath.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/venv_create.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/window_rename.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/xchmod.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/yamlcheck.py +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy.egg-info/SOURCES.txt +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy.egg-info/dependency_links.txt +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy.egg-info/entry_points.txt +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy.egg-info/requires.txt +0 -0
- {skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: skilleter_thingy
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.69
|
|
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
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
# TODO: Not sure it works properly as a pipe
|
|
12
12
|
# TODO: Error handling in file I/O
|
|
13
|
+
# TODO: Ability to remove Terraform 'will be read during apply' blocks (remove from '^ <= .* \{' to ^ \}$')
|
|
13
14
|
|
|
14
15
|
################################################################################
|
|
15
16
|
|
|
@@ -63,24 +64,34 @@ TF_IGNORE_LIST = [
|
|
|
63
64
|
|
|
64
65
|
################################################################################
|
|
65
66
|
|
|
67
|
+
def error(msg):
|
|
68
|
+
""" Report an error and quit """
|
|
69
|
+
|
|
70
|
+
sys.stderr.write(f'{msg}\n')
|
|
71
|
+
sys.exit(1)
|
|
72
|
+
|
|
73
|
+
################################################################################
|
|
74
|
+
|
|
66
75
|
def parse_command_line():
|
|
67
76
|
""" Parse, check and sanitise the command line arguments """
|
|
68
77
|
|
|
69
78
|
parser = argparse.ArgumentParser(description='Read from standard input and write to standard output modifying ANSI colour codes en-route.')
|
|
70
79
|
|
|
71
|
-
parser.add_argument('
|
|
72
|
-
parser.add_argument('
|
|
73
|
-
parser.add_argument('
|
|
74
|
-
parser.add_argument('
|
|
80
|
+
parser.add_argument('--light', '-l', action='store_true', help='Modify colours for a light background (the default)')
|
|
81
|
+
parser.add_argument('--dark', '-d', action='store_true', help='Modify colours for a dark background')
|
|
82
|
+
parser.add_argument('--none', '-n', action='store_true', help='Remove all colour codes')
|
|
83
|
+
parser.add_argument('--tidy', '-t', action='store_true',
|
|
75
84
|
help='Remove colour codes and stuff that typically occurs in log files causing diffs, but is of no particular interest (e.g. SHA1 values, times, dates)')
|
|
76
|
-
parser.add_argument('-
|
|
77
|
-
parser.add_argument('
|
|
78
|
-
parser.add_argument('
|
|
79
|
-
parser.add_argument('
|
|
80
|
-
parser.add_argument('
|
|
81
|
-
parser.add_argument('
|
|
82
|
-
parser.add_argument('
|
|
83
|
-
parser.add_argument('
|
|
85
|
+
parser.add_argument('--strip-blank', '-s', action='store_true', help='Strip all blank lines')
|
|
86
|
+
parser.add_argument('--debug', '-D', action='store_true', help='Replace colours with debug information')
|
|
87
|
+
parser.add_argument('--out', '-o', action='store_true', help='Output to standard output rather than overwriting input files')
|
|
88
|
+
parser.add_argument('--dir', '-O', action='store', default=None, help='Store output files in the specified directory (creating it if it doesn\'t exist)')
|
|
89
|
+
parser.add_argument('--aws', '-a', action='store_true', help='Remove AWS resource IDs')
|
|
90
|
+
parser.add_argument('--terraform', '-T', action='store_true', help='Clean Terraform plan/apply log files')
|
|
91
|
+
parser.add_argument('--replace', '-R', action='append', default=None, help='Additional regex replacements in the form "REGEX=REPLACEMENT"')
|
|
92
|
+
parser.add_argument('--verbose', '-v', action='store_true', help='Output verbose status')
|
|
93
|
+
parser.add_argument('--minimal', '-m', action='store_true', help='Remove unnecessary data from the file (e.g. Terraform progress updates (Refreshing..., Reading..., etc.))')
|
|
94
|
+
parser.add_argument('--non-minimal', '-M', action='store_true', help='Do not remove unnecessary data from the file (e.g. Terraform progress updates (Refreshing..., Reading..., etc.))')
|
|
84
95
|
parser.add_argument('files', nargs='*', default=None, help='The files to convert (use stdin/stout if no input files are specified)')
|
|
85
96
|
|
|
86
97
|
args = parser.parse_args()
|
|
@@ -94,23 +105,29 @@ def parse_command_line():
|
|
|
94
105
|
# Can't do more than one transformation
|
|
95
106
|
|
|
96
107
|
if args.light + args.dark + args.none + args.debug > 1:
|
|
97
|
-
|
|
98
|
-
sys.exit(1)
|
|
108
|
+
error('ERROR: Only one colour conversion option can be specified')
|
|
99
109
|
|
|
100
110
|
if args.tidy and (args.light or args.dark or args.debug):
|
|
101
|
-
|
|
102
|
-
sys.exit(1)
|
|
111
|
+
error('ERROR: The tidy and colour conversion options cannot be specified together')
|
|
103
112
|
|
|
104
|
-
|
|
113
|
+
if args.minimal and args.non_minimal:
|
|
114
|
+
error('ERROR: Cannot use minimal and non-minimal options together')
|
|
105
115
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
# Default to doing cleanup - removing colour codes, times & Terraform & minimal cleanup
|
|
117
|
+
|
|
118
|
+
if not args.light and not args.dark and not args.tidy and not args.strip_blank and not args.terraform and not args.minimal and not args.non_minimal:
|
|
119
|
+
args.strip_blank = args.none = args.tidy = args.terraform = args.minimal = True
|
|
120
|
+
logging.info('No options specified - defaulting to stripping blanks, removing colour codes, tidying, cleaning Terraform data and removing unnecessary data')
|
|
109
121
|
|
|
110
122
|
# Terraform option also removes ANSI, etc.
|
|
111
123
|
|
|
112
124
|
if args.terraform:
|
|
113
|
-
args.strip_blank = args.tidy = args.none = True
|
|
125
|
+
args.strip_blank = args.tidy = args.none = args.minimal = True
|
|
126
|
+
|
|
127
|
+
# Non-minimal overrides minimal
|
|
128
|
+
|
|
129
|
+
if args.non_minimal:
|
|
130
|
+
args.minimal = False
|
|
114
131
|
|
|
115
132
|
# Create the output directory, if required
|
|
116
133
|
|
|
@@ -206,9 +223,16 @@ def cleanfile(args, infile, outfile):
|
|
|
206
223
|
for entry in args.regex_replace:
|
|
207
224
|
clean = entry['regex'].sub(entry['replace'], clean)
|
|
208
225
|
|
|
226
|
+
# Additional cleanup - remove 'noise' from the output (currently just TF-related).
|
|
227
|
+
|
|
228
|
+
if args.minimal:
|
|
229
|
+
if args.terraform:
|
|
230
|
+
if TF_REFRESHING_AND_READING.match(clean):
|
|
231
|
+
clean = None
|
|
232
|
+
|
|
209
233
|
# Do things with Terraform log data
|
|
210
234
|
|
|
211
|
-
if args.terraform:
|
|
235
|
+
if clean and args.terraform:
|
|
212
236
|
clean = tidy.regex_replace(clean, TF_MISC_REGEX)
|
|
213
237
|
|
|
214
238
|
for ignore in TF_IGNORE_LIST:
|
|
@@ -308,7 +332,7 @@ def main():
|
|
|
308
332
|
if args.files:
|
|
309
333
|
try:
|
|
310
334
|
for filename in args.files:
|
|
311
|
-
with open(filename, 'rt') as infile:
|
|
335
|
+
with open(filename, 'rt', encoding='utf8') as infile:
|
|
312
336
|
|
|
313
337
|
# Either write to stdout or to a temporary file
|
|
314
338
|
|
|
@@ -332,12 +356,16 @@ def main():
|
|
|
332
356
|
if args.dir:
|
|
333
357
|
# Writing to a directory - just move the output file there unconditionally
|
|
334
358
|
|
|
359
|
+
logging.info('Writing %s to %s', outfile_name, args.dir)
|
|
360
|
+
|
|
335
361
|
shutil.move(outfile_name, os.path.join(args.dir, os.path.basename(filename)))
|
|
336
362
|
|
|
337
363
|
elif not filecmp.cmp(outfile_name, filename, shallow=False):
|
|
338
364
|
# Only backup and write the source file if changes have been made (original is
|
|
339
365
|
# left in place without a backup if nothing's changed)
|
|
340
366
|
|
|
367
|
+
logging.info('Backing up old file and writing new %s', outfile_name)
|
|
368
|
+
|
|
341
369
|
files.backup(filename)
|
|
342
370
|
|
|
343
371
|
shutil.move(outfile_name, filename)
|
|
@@ -345,6 +373,8 @@ def main():
|
|
|
345
373
|
else:
|
|
346
374
|
# Output file hasn't been used, so just delete it
|
|
347
375
|
|
|
376
|
+
logging.info('No changes made to %s', outfile_name)
|
|
377
|
+
|
|
348
378
|
os.unlink(outfile_name)
|
|
349
379
|
|
|
350
380
|
except FileNotFoundError as exc:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: skilleter_thingy
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.69
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy/thingy/venv_template.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{skilleter_thingy-0.0.67 → skilleter_thingy-0.0.69}/skilleter_thingy.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|