File: command-not-found

package info (click to toggle)
command-not-found 0.2.38-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 1,248 kB
  • ctags: 199
  • sloc: python: 824; makefile: 42; sh: 18
file content (29 lines) | stat: -rwxr-xr-x 1,195 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/python
# (c) Zygmunt Krynicki 2005, 2006, 2007, 2008
# Licensed under GPL, see COPYING for the whole text

__version__ = "0.2.26"
BUG_REPORT_URL="http://www.debian.org/Bugs/Reporting"

import CommandNotFound
import sys
from CommandNotFound.util import crash_guard, gettext_wrapper as _
from CommandNotFound import CommandNotFound
from optparse import OptionParser

def main():
    parser = OptionParser(version = __version__, usage=_("%prog [options] <command-name>"))
    parser.add_option('-d', '--data-dir', action='store',
                      default="/var/cache/command-not-found",
                      help=_("use this path to locate data fields"))
    parser.add_option('--ignore-installed', '--ignore-installed',
                      action='store_true',  default=False,
                      help=_("ignore local binaries and display the available packages"))
    (options, args) = parser.parse_args()
    if len(args) == 1:
        cnf = CommandNotFound(options.data_dir)
        cnf.advise(args[0], options.ignore_installed)
        print >>sys.stderr, _("%s: command not found") % args[0]

if __name__ == "__main__":
    crash_guard(main, BUG_REPORT_URL, __version__)