diff options
author | 2019-06-16 22:21:13 +0530 | |
---|---|---|
committer | 2019-06-17 07:04:42 +0530 | |
commit | 794a0e27091b63f997fc829d0288cde5a4a2edbd (patch) | |
tree | 384695218b8cf09700df81715627004124e0edf7 /scripts/natool | |
parent | aa56b99326a12f5bbab6d5a693755060e81e44a2 (diff) | |
download | nnn-794a0e27091b63f997fc829d0288cde5a4a2edbd.tar.gz |
Move scripts to misc
Diffstat (limited to 'scripts/natool')
-rwxr-xr-x | scripts/natool/natool | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/scripts/natool/natool b/scripts/natool/natool deleted file mode 100755 index 0b00066..0000000 --- a/scripts/natool/natool +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python3 - -# ############################################################################# -# natool: a wrapper script to patool to list, extract and create archives -# -# 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 -# -# Brief: -# natool is written to integrate patool (instead of the default atool) with nnn -# A copies of this file should be dropped somewhere in $PATH as atool -# -# Author: Arun Prakash Jana -# Email: engineerarun@gmail.com -# Homepage: https://github.com/jarun/nnn -# Copyright © 2019 Arun Prakash Jana -# ############################################################################# - -import sys -from subprocess import Popen, PIPE, DEVNULL - -if len(sys.argv) < 3: - print('usage: natool [-a] [-l] [-x] [archive] [file/dir]') - sys.exit(0) - -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: - sys.exit(0) - -pipe = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) -out, err = pipe.communicate() -print(out.decode()) -print(err.decode()) |