malcontent-client: Rename ‘set’ command to ‘set-app-filter’

Since it operates only on the app filter. This doesn’t update the
documentation because none has been written for this command yet.
No compatibility fallback is provided.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2020-01-16 11:29:05 +00:00
parent 2b180a9afd
commit b3dbc07b92
1 changed files with 41 additions and 37 deletions

View File

@ -279,9 +279,10 @@ def command_oars_section(user, section, quiet=False, interactive=True):
section, user_id, __oars_value_to_string(value))) section, user_id, __oars_value_to_string(value)))
def command_set(user, allow_user_installation=True, def command_set_app_filter(user, allow_user_installation=True,
allow_system_installation=False, app_filter_args=None, allow_system_installation=False,
quiet=False, interactive=True): app_filter_args=None, quiet=False,
interactive=True):
"""Set the app filter for the given user.""" """Set the app filter for the given user."""
user_id = __lookup_user_id_or_error(user) user_id = __lookup_user_id_or_error(user)
builder = Malcontent.AppFilterBuilder.new() builder = Malcontent.AppFilterBuilder.new()
@ -399,39 +400,42 @@ def main():
'user)') 'user)')
parser_oars_section.add_argument('section', help='OARS section to get') parser_oars_section.add_argument('section', help='OARS section to get')
# set command # set-app-filter command
parser_set = subparsers.add_parser('set', parents=[common_parser], parser_set_app_filter = \
help='set current parental controls ' subparsers.add_parser('set-app-filter', parents=[common_parser],
'settings') help='set current app filter settings')
parser_set.set_defaults(function=command_set) parser_set_app_filter.set_defaults(function=command_set_app_filter)
parser_set.add_argument('user', default='', nargs='?', parser_set_app_filter.add_argument('user', default='', nargs='?',
help='user ID or username to set the app filter ' help='user ID or username to set the '
'for (default: current user)') 'app filter for (default: current '
parser_set.add_argument('--allow-user-installation', 'user)')
parser_set_app_filter.add_argument('--allow-user-installation',
dest='allow_user_installation', dest='allow_user_installation',
action='store_true', action='store_true',
help='allow installation to the user flatpak ' help='allow installation to the user '
'repo in general') 'flatpak repo in general')
parser_set.add_argument('--disallow-user-installation', parser_set_app_filter.add_argument('--disallow-user-installation',
dest='allow_user_installation', dest='allow_user_installation',
action='store_false', action='store_false',
help='unconditionally disallow installation to ' help='unconditionally disallow '
'the user flatpak repo') 'installation to the user flatpak '
parser_set.add_argument('--allow-system-installation', 'repo')
parser_set_app_filter.add_argument('--allow-system-installation',
dest='allow_system_installation', dest='allow_system_installation',
action='store_true', action='store_true',
help='allow installation to the system flatpak ' help='allow installation to the system '
'repo in general') 'flatpak repo in general')
parser_set.add_argument('--disallow-system-installation', parser_set_app_filter.add_argument('--disallow-system-installation',
dest='allow_system_installation', dest='allow_system_installation',
action='store_false', action='store_false',
help='unconditionally disallow installation to ' help='unconditionally disallow '
'the system flatpak repo') 'installation to the system '
parser_set.add_argument('app_filter_args', nargs='*', 'flatpak repo')
help='paths, content types or flatpak refs to ' parser_set_app_filter.add_argument('app_filter_args', nargs='*',
'blacklist and OARS section=value ' help='paths, content types or flatpak '
'pairs to store') 'refs to blacklist and OARS '
parser_set.set_defaults(allow_user_installation=True, 'section=value pairs to store')
parser_set_app_filter.set_defaults(allow_user_installation=True,
allow_system_installation=False) allow_system_installation=False)
# Parse the command line arguments and run the subcommand. # Parse the command line arguments and run the subcommand.