File size: 821 Bytes
9ae74ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python

import distutils.spawn
import os
import sys
sys.path.append(os.path.dirname(distutils.spawn.find_executable("silent_tools.py")))
import silent_tools
from silent_tools import eprint

# Don't throw an error when someone uses head
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL) 

if (len(sys.argv) == 1):
    eprint("")
    eprint('silentls by bcov - a tool to allow you to "ls" a silent file')
    eprint("Usage:")
    eprint("        silentls myfile.silent")
    sys.exit(1)


files = sys.argv[1:]


for ifile in range(len(files)):

    file = files[ifile]

    if (len(files) > 1):
        print(file + ":")

    silent_index = silent_tools.get_silent_index( file )

    for tag in silent_index["tags"]:
        print(tag)

    if (ifile + 1 < len(files)):
        print("")