3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
19 from dss.cli import dss_clihandlers
22 def __init__(self, prog):
25 def __call__(self, args):
26 parser = argparse.ArgumentParser(description='dss CLI', prog=self.prog)
27 parser.add_argument('--server',
30 default='/var/run/.dss-server',
34 parser.add_argument('--verbose',
39 subparsers = parser.add_subparsers()
40 handlers = dss_clihandlers.get_handlers_list()
41 for handler in handlers:
42 handler.init_subparser(subparsers)
44 parse_result = parser.parse_args(args)
46 parse_result.handler(parse_result)
49 if __name__ == '__main__':
50 processor = CLIProcessor('dsscli')
54 except Exception as error:
55 print('Got error %s' % str(error))