OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (C) 2013 Marco Ceppi <marco@ceppi.net>. | 2 # Copyright (C) 2013 Marco Ceppi <marco@ceppi.net>. |
3 # | 3 # |
4 # This program is free software: you can redistribute it and/or modify | 4 # This program is free software: you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License as published by | 5 # it under the terms of the GNU General Public License as published by |
6 # the Free Software Foundation, either version 3 of the License, or | 6 # the Free Software Foundation, either version 3 of the License, or |
7 # (at your option) any later version. | 7 # (at your option) any later version. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. |
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 |
17 import os | |
18 import sys | |
19 import re | |
20 import argparse | 17 import argparse |
21 | 18 |
22 from . import charms | 19 from . import charms |
23 | 20 |
24 | 21 |
25 def setup_parser(): | 22 def setup_parser(): |
26 parser = argparse.ArgumentParser(prog='charm search', | 23 parser = argparse.ArgumentParser(prog='charm search', |
27 description='Match name against all ' | 24 description='Match name against all ' |
28 'charms (official and personal) in store') | 25 'charms (official and personal) in store') |
29 parser.add_argument('name', nargs=1, help='Name which to search by') | 26 parser.add_argument('name', nargs=1, help='Name which to search by') |
30 | 27 |
31 return parser | 28 return parser |
32 | 29 |
33 | 30 |
34 def main(): | 31 def main(): |
35 parser = setup_parser() | 32 parser = setup_parser() |
36 args = parser.parse_args() | 33 args = parser.parse_args() |
37 matches = [c for c in charms.remote() if args.name[0] in c] | 34 matches = [c for c in charms.remote() if args.name[0] in c] |
38 print '\n'.join(matches) | 35 print '\n'.join(matches) |
OLD | NEW |