From b3dbc07b927d6e44ba8bb9d84756f905fe8f7d37 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 16 Jan 2020 11:29:05 +0000 Subject: [PATCH] =?UTF-8?q?malcontent-client:=20Rename=20=E2=80=98set?= =?UTF-8?q?=E2=80=99=20command=20to=20=E2=80=98set-app-filter=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- malcontent-client/malcontent-client.py | 78 ++++++++++++++------------ 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/malcontent-client/malcontent-client.py b/malcontent-client/malcontent-client.py index 7b7ac28..261286c 100644 --- a/malcontent-client/malcontent-client.py +++ b/malcontent-client/malcontent-client.py @@ -279,9 +279,10 @@ def command_oars_section(user, section, quiet=False, interactive=True): section, user_id, __oars_value_to_string(value))) -def command_set(user, allow_user_installation=True, - allow_system_installation=False, app_filter_args=None, - quiet=False, interactive=True): +def command_set_app_filter(user, allow_user_installation=True, + allow_system_installation=False, + app_filter_args=None, quiet=False, + interactive=True): """Set the app filter for the given user.""" user_id = __lookup_user_id_or_error(user) builder = Malcontent.AppFilterBuilder.new() @@ -399,40 +400,43 @@ def main(): 'user)') parser_oars_section.add_argument('section', help='OARS section to get') - # ‘set’ command - parser_set = subparsers.add_parser('set', parents=[common_parser], - help='set current parental controls ' - 'settings') - parser_set.set_defaults(function=command_set) - parser_set.add_argument('user', default='', nargs='?', - help='user ID or username to set the app filter ' - 'for (default: current user)') - parser_set.add_argument('--allow-user-installation', - dest='allow_user_installation', - action='store_true', - help='allow installation to the user flatpak ' - 'repo in general') - parser_set.add_argument('--disallow-user-installation', - dest='allow_user_installation', - action='store_false', - help='unconditionally disallow installation to ' - 'the user flatpak repo') - parser_set.add_argument('--allow-system-installation', - dest='allow_system_installation', - action='store_true', - help='allow installation to the system flatpak ' - 'repo in general') - parser_set.add_argument('--disallow-system-installation', - dest='allow_system_installation', - action='store_false', - help='unconditionally disallow installation to ' - 'the system flatpak repo') - parser_set.add_argument('app_filter_args', nargs='*', - help='paths, content types or flatpak refs to ' - 'blacklist and OARS section=value ' - 'pairs to store') - parser_set.set_defaults(allow_user_installation=True, - allow_system_installation=False) + # ‘set-app-filter’ command + parser_set_app_filter = \ + subparsers.add_parser('set-app-filter', parents=[common_parser], + help='set current app filter settings') + parser_set_app_filter.set_defaults(function=command_set_app_filter) + parser_set_app_filter.add_argument('user', default='', nargs='?', + help='user ID or username to set the ' + 'app filter for (default: current ' + 'user)') + parser_set_app_filter.add_argument('--allow-user-installation', + dest='allow_user_installation', + action='store_true', + help='allow installation to the user ' + 'flatpak repo in general') + parser_set_app_filter.add_argument('--disallow-user-installation', + dest='allow_user_installation', + action='store_false', + help='unconditionally disallow ' + 'installation to the user flatpak ' + 'repo') + parser_set_app_filter.add_argument('--allow-system-installation', + dest='allow_system_installation', + action='store_true', + help='allow installation to the system ' + 'flatpak repo in general') + parser_set_app_filter.add_argument('--disallow-system-installation', + dest='allow_system_installation', + action='store_false', + help='unconditionally disallow ' + 'installation to the system ' + 'flatpak repo') + parser_set_app_filter.add_argument('app_filter_args', nargs='*', + help='paths, content types or flatpak ' + 'refs to blacklist and OARS ' + 'section=value pairs to store') + parser_set_app_filter.set_defaults(allow_user_installation=True, + allow_system_installation=False) # Parse the command line arguments and run the subcommand. args = parser.parse_args()