~rajeevs1992/mailman.client/mailmancli

« back to all changes in this revision

Viewing changes to src/mailmanclient/cli/client/cmdparser.py

  • Committer: Rajeev S
  • Date: 2014-06-16 17:37:41 UTC
  • Revision ID: rajeevs1992@gmail.com-20140616173741-kffpv988jp6p6pj5
- adds describe feature that describes the
  instance of scope, made by extending the
  `show` functionality
- adds subscribe and unsubscribe feature to the
  user scope
- adds unittests for the users scope

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
        # Show lists
40
40
        show_list = scope.add_parser('list')
 
41
        show_list.add_argument('list',
 
42
                               help='List details about LIST',
 
43
                               nargs='?')
41
44
        show_list.add_argument('-d',
42
45
                               '--domain',
43
46
                               help='Filter by DOMAIN')
51
54
 
52
55
        # Show domains
53
56
        show_domain = scope.add_parser('domain')
 
57
        show_domain.add_argument('domain',
 
58
                                 help='List details about DOMAIN',
 
59
                                 nargs='?')
54
60
        show_domain.add_argument('-v',
55
61
                                 '--verbose',
56
62
                                 help='Detailed listing',
61
67
 
62
68
        # Show users
63
69
        show_user = scope.add_parser('user')
 
70
        show_user.add_argument('user',
 
71
                               help='List details about USER',
 
72
                               nargs='?')
64
73
        show_user.add_argument('-v',
65
74
                               '--verbose',
66
75
                               help='Detailed listing',
124
133
                                 help='Force delete',
125
134
                                 action='store_true')
126
135
 
 
136
        # Parser for the action `subscribe`
 
137
        action_subscribe = action.add_parser('subscribe')
 
138
        scope = action_subscribe.add_subparsers(dest='scope')
 
139
        subscribe_user = scope.add_parser('user')
 
140
        subscribe_user.add_argument('users',
 
141
                                    help='User email list',
 
142
                                    nargs='+')
 
143
        subscribe_user.add_argument('-l',
 
144
                                    '--list',
 
145
                                    help='Specify list name',
 
146
                                    dest='list_name',
 
147
                                    required=True)
 
148
        subscribe_user.add_argument('--quiet',
 
149
                                    help='Do not display feedback',
 
150
                                    action='store_true')
 
151
 
 
152
        # Parser for the action `unsubscribe`
 
153
        action_subscribe = action.add_parser('unsubscribe')
 
154
        scope = action_subscribe.add_subparsers(dest='scope')
 
155
        subscribe_user = scope.add_parser('user')
 
156
        subscribe_user.add_argument('users',
 
157
                                    help='User email list',
 
158
                                    nargs='+')
 
159
        subscribe_user.add_argument('-l',
 
160
                                    '--list',
 
161
                                    help='Specify list name',
 
162
                                    dest='list_name',
 
163
                                    required=True)
 
164
        subscribe_user.add_argument('--quiet',
 
165
                                    help='Do not display feedback',
 
166
                                    action='store_true')
127
167
        # Global options
128
168
        parser.add_argument('--host', help='REST API host address',
129
169
                            default='http://127.0.0.1')