From 5af08abde50b5a8552966c599fb692e46e74a707 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Thu, 9 Nov 2023 12:56:49 +0100 Subject: [PATCH] Add a new command 'patool version' to show version information --- doc/changelog.txt | 1 + doc/patool.1 | 4 ++++ doc/patool.txt | 5 +++++ patoolib/cli.py | 7 +++++++ 4 files changed, 17 insertions(+) diff --git a/doc/changelog.txt b/doc/changelog.txt index 00a63e25..7c2bd3ac 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -17,6 +17,7 @@ * Removed the recompress command. * Use the new filter option when extracting TAR archives with the tarfile module in Python >= 3.12 to detect unsafe archive entries. +* Added new command "patool version" to print version information. 1.15.0 (released 28.10.2023) diff --git a/doc/patool.1 b/doc/patool.1 index 0e105a02..0b328221 100644 --- a/doc/patool.1 +++ b/doc/patool.1 @@ -135,6 +135,10 @@ determined by the file extension of \fIarchive_new\fP. .PP Show all supported archive formats (i.e. which helper applications are available). +.SS version +\fBpatool\fP \version\fP +.PP +Print version information. .SH HELP OPTION Specifying the help option displays help for patool itself, or a command. diff --git a/doc/patool.txt b/doc/patool.txt index cc2ca39a..96d874e8 100644 --- a/doc/patool.txt +++ b/doc/patool.txt @@ -136,6 +136,11 @@ COMMANDS Show all supported archive formats (i.e. which helper applica‐ tions are available). + version + patool sion + + Print version information. + HELP OPTION Specifying the help option displays help for patool itself, or a command. diff --git a/patoolib/cli.py b/patoolib/cli.py index 55dd542c..a373fdbc 100644 --- a/patoolib/cli.py +++ b/patoolib/cli.py @@ -120,6 +120,11 @@ def run_formats (args): return 0 +def run_version(args): + print(App) + return 0 + + class ArgumentParser(argparse.ArgumentParser): """Custom argument parser.""" @@ -191,6 +196,8 @@ def create_argparser(): parser_search.add_argument('archive', help='the archive file') # formats subparsers.add_parser('formats', help="show supported archive formats") + # version + subparsers.add_parser('version', help="print version information") # optional bash completion try: import argcomplete