Ability to enter archives (jar, tar, zip, 7z, etc.)
Did a discussion occur before? => Yes
Is your feature request related to a problem? Please describe. => Nope
Describe the solution you'd like
Coming from both midnight commander (mc), and ranger sometimes, I'd like the ability to enter archives to navigate them in broot.
Eventually have to possibility to extract a specific file inside the archive / and or see it if it's text.
Describe alternatives you've considered
I'm using mc instead for this purpose.
Additional context Of course I think broot should not display files in the archive automatically, the user would have to enter the archive.
if you have installed archivemount, you could configure it in your conf.toml:
[[verbs]] invocation = "archivemount" shortcut = "am" external = "am.sh {file-name}" leave_broot = false auto_exec = true set_working_dir = true apply_to = "file"
[[verbs]] invocation = "viewarchivemount" key = "ctrl-shift-F6" shortcut = "vam" auto_exec = true set_working_dir = true cmd = ":mkdir -p /tmp/{file-name};:am;:!focus /tmp/{file-name}.archivemount"
[[verbs]] invocation = "unmountarchivemount" key = "ctrl-shift-F7" shortcut = "uam" external = "umount /tmp/{file-name}.archivemount" leave_broot = true auto_exec = false set_working_dir = true
with am.sh:
mkdir -p /tmp/"$1".archivemount; archivemount -o nonempty "$1" /tmp/"$1".archivemount
Another alternative to @snieda's, using 7z (or other compatible archiver), and nushell parsing functions:
{
name: zip_list_files
invocation: zipl
external: [
"nu"
"-e"
'''
let zip_list_files_all = (
7z l '{file}'
| lines
)
let zip_meta = (
$zip_list_files_all
| range ..16
)
let zip_content_index = (
$zip_meta
| range 8..
| reduce --fold 5 {|it, acc|
if ($it | str starts-with ' Date') {return $acc} else {$acc + 1}
}
)
print (
$zip_meta
| range 9..($zip_content_index - 2)
| parse '{key} = {value}'
| transpose --header-row
| update 'Physical Size' {|| into filesize }
)
let zipl_header_Name_index = (
$zip_list_files_all
| get $zip_content_index
| str index-of Name
)
let zipl_files = (
$zip_list_files_all
| range ($zip_content_index + 1)..-3
| each {|| str substring $zipl_header_Name_index..}
)
print $zipl_files
let zipl = (
$zip_list_files_all
| range ($zip_content_index)..-3
| str join "\n"
| from ssv -m 1
| drop nth 0
| update Size {|| into filesize }
| update Compressed {|| into filesize }
| update Date {|row|
$'($row.Date) $($row.Time)'
| into datetime
}
| reject Time
| update Name $zipl_files
| sort-by Size
)
print $zipl
echo `$zipl`
'''
]
apply_to: file
extensions: [
zip
rar
7z
7zip
lzma
]
leave_broot: false
}
You can adapt it to your own shell, archiver, and remove the stuff you don't need