BSD systems, well, at least, FreeBSD and OpenBSD feature 3rd party packages in a ports-system. The python script below lets you search for ports by substring:
#!/home/hdiwan/.virtualenvs/ports/bin/python
import argparse
import csv
INDEX = '/usr/ports/INDEX'
if __name__ == '__main__':
args_ = argparse.ArgumentParser(description='Ports tool for OpenBSD')
args_.add_argument('query', help='Query', type=unicode, action='store')
args = args_.parse_args()
with open(INDEX, 'r') as index:
reader = csv.reader(index, delimiter='|')
print(args.query)
for line in list(reader):
if line[0].find(args.query) > 0:
print line[0]
exit
You need python and to have an index file (modify the path if necessary). The output of this looks like:
% python ./ports.py -q "ruby" ruby jruby-jdbc-h2-1.3.170.1 jruby-jdbc-mysql-5.1.22.1 jruby-jdbc-postgres-9.2.1002.1 jruby-jdbc-sqlite3-3.7.2.1 vim-7.4.135p0-gtk2-perl-python-ruby vim-7.4.135p0-gtk2-perl-python3-ruby vim-7.4.135p0-no_x11-perl-python-ruby vim-7.4.135p0-no_x11-perl-python3-ruby jruby-1.7.9 weechat-ruby-0.4.2 eruby-1.0.5p14 mod_ruby-1.2.6p7 jruby-profligacy-1.0
No comments:
Post a Comment