Commit 1a439dcf authored by François Grisez's avatar François Grisez

Add a positionnal argument to REGISTRAR_CLEAR subparser

parent d1fb7a73
Pipeline #6087 passed with stages
in 38 minutes and 48 seconds
......@@ -3,6 +3,7 @@
from __future__ import print_function # needed for using print() instead of 'print' statement with Python 2
import argparse
import os.path
import sys
......@@ -19,12 +20,14 @@ def parse_args():
'CONFIG_GET': {'help': 'Get the value of an internal variable of Flexisip.'},
'CONFIG_SET': {'help': 'Set the value of an internal variable of Flexisip.'},
'CONFIG_LIST': {'help': 'List all the available parameters of a section.'},
'REGISTRAR_CLEAR': {'help': 'Clear the registrar database.'}
'REGISTRAR_CLEAR': {'help': 'Remove a user from the registrar database.'}
}
kargs = {
'dest': 'command',
'metavar': 'command',
'help': """Action to do on the server. Type `{prog} <command> --help` for detailed
documentation about the given command.""".format(prog=os.path.basename(sys.argv[0]))
}
if sys.version_info[0] == 3:
kargs['required'] = True
......@@ -41,6 +44,7 @@ def parse_args():
commands['CONFIG_LIST']['parser'].add_argument('section_name', nargs='?', default='all',
help='The name of the section. The list of all available sections is returned if no section name is given.'
)
commands['REGISTRAR_CLEAR']['parser'].add_argument('uri', help='SIP URI of the user.')
return parser.parse_args()
......@@ -71,6 +75,8 @@ def formatMessage(args):
messageArgs += [args.path, args.value]
elif args.command == 'CONFIG_LIST':
messageArgs.append(args.section_name)
elif args.command == 'REGISTRAR_CLEAR':
messageArgs.append(args.uri)
return ' '.join(messageArgs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment