Skip to content

Commit 08e7c63

Browse files
committed
Allow to choose the Matcher from the command line
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
1 parent 5f80c94 commit 08e7c63

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

rotate_backups/cli.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@
168168
readable and/or writable for the current user (or the user logged in to a
169169
remote system over SSH).
170170
171+
-s, --stat-timestamp
172+
173+
Use mtime stat timestamps, instead of filenames, to determine the
174+
date of each file.
175+
171176
-S, --syslog=CHOICE
172177
173178
Explicitly enable or disable system logging instead of letting the program
@@ -241,12 +246,12 @@ def main():
241246
selected_locations = []
242247
# Parse the command line arguments.
243248
try:
244-
options, arguments = getopt.getopt(sys.argv[1:], 'M:H:d:w:m:y:t:I:x:jpri:c:C:uS:fnvqh', [
249+
options, arguments = getopt.getopt(sys.argv[1:], 'M:H:d:w:m:y:t:I:x:jpri:c:C:usS:fnvqh', [
245250
'minutely=', 'hourly=', 'daily=', 'weekly=', 'monthly=', 'yearly=',
246251
'timestamp-pattern=', 'include=', 'exclude=', 'parallel',
247252
'prefer-recent', 'relaxed', 'ionice=', 'config=',
248-
'removal-command=', 'use-sudo', 'syslog=', 'force',
249-
'dry-run', 'verbose', 'quiet', 'help',
253+
'removal-command=', 'use-sudo', 'stat-timestamp', 'syslog=',
254+
'force', 'dry-run', 'verbose', 'quiet', 'help',
250255
])
251256
for option, value in options:
252257
if option in ('-M', '--minutely'):
@@ -284,6 +289,8 @@ def main():
284289
kw['removal_command'] = removal_command
285290
elif option in ('-u', '--use-sudo'):
286291
use_sudo = True
292+
elif option in ('-s', '--stat-timestamp'):
293+
kw['stat_timestamp'] = True
287294
elif option in ('-S', '--syslog'):
288295
use_syslog = coerce_boolean(value)
289296
elif option in ('-f', '--force'):

0 commit comments

Comments
 (0)