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

There’ll be other types of getting happening soon.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-12-04 15:52:03 +00:00
parent a7947d56e6
commit 2b180a9afd
2 changed files with 18 additions and 15 deletions

View File

@ -10,7 +10,7 @@ malcontent\-client — Parental Controls Access Utility
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.\"
\fBmalcontent\-client get [\-q] [\-n] [\fPUSER\fB]
\fBmalcontent\-client get\-app\-filter [\-q] [\-n] [\fPUSER\fB]
.PP
\fBmalcontent\-client check [\-q] [\-n] [\fPUSER\fB] \fPARG\fB
.\"
@ -25,10 +25,10 @@ controls.
It communicates with accounts-service, which stores parental controls data.
.PP
Its first argument is a command to run. Currently, the only supported commands
are \fBget\fP and \fBcheck\fP.
are \fBget\-app\-filter\fP and \fBcheck\fP.
.\"
.SH \fBget\fP OPTIONS
.IX Header "get OPTIONS"
.SH \fBget\-app\-filter\fP OPTIONS
.IX Header "get\-app\-filter OPTIONS"
.\"
.IP "\fBUSER\fP"
Username or ID of the user to get the app filter for. If not specified, the

View File

@ -138,7 +138,7 @@ def __oars_value_from_string(value_str):
raise KeyError('Unknown OARS value {}'.format(value_str))
def command_get(user, quiet=False, interactive=True):
def command_get_app_filter(user, quiet=False, interactive=True):
"""Get the app filter for the given user."""
user_id = __lookup_user_id_or_error(user)
app_filter = __get_app_filter_or_error(user_id, interactive)
@ -335,8 +335,9 @@ def main():
parser = argparse.ArgumentParser(
description='Query and update parental controls.')
subparsers = parser.add_subparsers(metavar='command',
help='command to run (default: get)')
parser.set_defaults(function=command_get)
help='command to run (default: '
'get-app-filter)')
parser.set_defaults(function=command_get_app_filter)
parser.add_argument('-q', '--quiet', action='store_true',
help='output no informational messages')
parser.set_defaults(quiet=False)
@ -353,14 +354,16 @@ def main():
help='opposite of --no-interactive')
common_parser.set_defaults(interactive=True)
# get command
parser_get = subparsers.add_parser('get', parents=[common_parser],
help='get current parental controls '
'settings')
parser_get.set_defaults(function=command_get)
parser_get.add_argument('user', default='', nargs='?',
help='user ID or username to get the app filter '
'for (default: current user)')
# get-app-filter command
parser_get_app_filter = \
subparsers.add_parser('get-app-filter',
parents=[common_parser],
help='get current app filter settings')
parser_get_app_filter.set_defaults(function=command_get_app_filter)
parser_get_app_filter.add_argument('user', default='', nargs='?',
help='user ID or username to get the '
'app filter for (default: current '
'user)')
# monitor command
parser_monitor = subparsers.add_parser('monitor',