diff options
author | 2019-05-19 21:44:58 +0530 | |
---|---|---|
committer | 2019-05-22 08:48:44 +0530 | |
commit | 2c2d49780953a09c7aeed3269bc2cff433263e84 (patch) | |
tree | 253f1a3cf19d3d9164a18b2d7becc35ba94bdc23 /scripts/natool | |
parent | 5f6ceb2f43794bc6d4c31567624e46b7686202d6 (diff) | |
download | nnn-2c2d49780953a09c7aeed3269bc2cff433263e84.tar.gz |
Update patool wrapper
Diffstat (limited to 'scripts/natool')
-rwxr-xr-x | scripts/natool/natool | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/scripts/natool/natool b/scripts/natool/natool index 168a22d..0b00066 100755 --- a/scripts/natool/natool +++ b/scripts/natool/natool @@ -3,16 +3,16 @@ # ############################################################################# # natool: a wrapper script to patool to list, extract and create archives # -# usage: natool [-l] [-x] [archive] [file/dir] +# usage: natool [-a] [-l] [-x] [archive] [file/dir] # # Examples: +# - create archive : natool -a archive.7z archive_dir # - list archive : natool -l archive.7z # - extract archive: natool -x archive.7z -# - create archive : natool archive.7z archive_dir # # Brief: # natool is written to integrate patool (instead of the default atool) with nnn -# Two copies of this file should be dropped somewhere in $PATH - atool, apack +# A copies of this file should be dropped somewhere in $PATH as atool # # Author: Arun Prakash Jana # Email: engineerarun@gmail.com @@ -24,17 +24,20 @@ import sys from subprocess import Popen, PIPE, DEVNULL if len(sys.argv) < 3: - print('usage: natool [-l] [-x] [archive] [file/dir]') + print('usage: natool [-a] [-l] [-x] [archive] [file/dir]') sys.exit(0) -if sys.argv[1] == '-x': - cmd = ['patool', '--non-interactive', 'extract'] +if sys.argv[1] == '-a': + cmd = ['patool', '--non-interactive', 'create', sys.argv[2]] + cmd.extend(sys.argv[3:]) elif sys.argv[1] == '-l': cmd = ['patool', '--non-interactive', 'list'] + cmd.extend(sys.argv[2:]) +elif sys.argv[1] == '-x': + cmd = ['patool', '--non-interactive', 'extract'] + cmd.extend(sys.argv[2:]) else: - cmd = ['patool', '--non-interactive', 'create', sys.argv[1]] - -cmd.extend(sys.argv[2:]) + sys.exit(0) pipe = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) out, err = pipe.communicate() |