mirror of https://github.com/jarun/nnn.git
Update patool wrapper
This commit is contained in:
parent
5f6ceb2f43
commit
2c2d497809
|
@ -3,16 +3,16 @@
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# natool: a wrapper script to patool to list, extract and create archives
|
# 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:
|
# Examples:
|
||||||
|
# - create archive : natool -a archive.7z archive_dir
|
||||||
# - list archive : natool -l archive.7z
|
# - list archive : natool -l archive.7z
|
||||||
# - extract archive: natool -x archive.7z
|
# - extract archive: natool -x archive.7z
|
||||||
# - create archive : natool archive.7z archive_dir
|
|
||||||
#
|
#
|
||||||
# Brief:
|
# Brief:
|
||||||
# natool is written to integrate patool (instead of the default atool) with nnn
|
# 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
|
# Author: Arun Prakash Jana
|
||||||
# Email: engineerarun@gmail.com
|
# Email: engineerarun@gmail.com
|
||||||
|
@ -24,17 +24,20 @@ import sys
|
||||||
from subprocess import Popen, PIPE, DEVNULL
|
from subprocess import Popen, PIPE, DEVNULL
|
||||||
|
|
||||||
if len(sys.argv) < 3:
|
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)
|
sys.exit(0)
|
||||||
|
|
||||||
if sys.argv[1] == '-x':
|
if sys.argv[1] == '-a':
|
||||||
cmd = ['patool', '--non-interactive', 'extract']
|
cmd = ['patool', '--non-interactive', 'create', sys.argv[2]]
|
||||||
|
cmd.extend(sys.argv[3:])
|
||||||
elif sys.argv[1] == '-l':
|
elif sys.argv[1] == '-l':
|
||||||
cmd = ['patool', '--non-interactive', 'list']
|
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:
|
else:
|
||||||
cmd = ['patool', '--non-interactive', 'create', sys.argv[1]]
|
sys.exit(0)
|
||||||
|
|
||||||
cmd.extend(sys.argv[2:])
|
|
||||||
|
|
||||||
pipe = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
pipe = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||||
out, err = pipe.communicate()
|
out, err = pipe.communicate()
|
||||||
|
|
|
@ -3896,7 +3896,7 @@ nochange:
|
||||||
char cmd[] = "bsdtar -cf";
|
char cmd[] = "bsdtar -cf";
|
||||||
|
|
||||||
if (getutil(utils[ATOOL]))
|
if (getutil(utils[ATOOL]))
|
||||||
xstrlcpy(cmd, "atool -qa", 10);
|
xstrlcpy(cmd, "atool -a", 10);
|
||||||
else if (!getutil(utils[BSDTAR])) {
|
else if (!getutil(utils[BSDTAR])) {
|
||||||
printwait(messages[UTIL_MISSING], &presel);
|
printwait(messages[UTIL_MISSING], &presel);
|
||||||
goto nochange;
|
goto nochange;
|
||||||
|
|
Loading…
Reference in New Issue