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 .SH SYNOPSIS
.IX Header "SYNOPSIS" .IX Header "SYNOPSIS"
.\" .\"
\fBmalcontent\-client get [\-q] [\-n] [\fPUSER\fB] \fBmalcontent\-client get\-app\-filter [\-q] [\-n] [\fPUSER\fB]
.PP .PP
\fBmalcontent\-client check [\-q] [\-n] [\fPUSER\fB] \fPARG\fB \fBmalcontent\-client check [\-q] [\-n] [\fPUSER\fB] \fPARG\fB
.\" .\"
@ -25,10 +25,10 @@ controls.
It communicates with accounts-service, which stores parental controls data. It communicates with accounts-service, which stores parental controls data.
.PP .PP
Its first argument is a command to run. Currently, the only supported commands 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 .SH \fBget\-app\-filter\fP OPTIONS
.IX Header "get OPTIONS" .IX Header "get\-app\-filter OPTIONS"
.\" .\"
.IP "\fBUSER\fP" .IP "\fBUSER\fP"
Username or ID of the user to get the app filter for. If not specified, the 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)) 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.""" """Get the app filter for the given user."""
user_id = __lookup_user_id_or_error(user) user_id = __lookup_user_id_or_error(user)
app_filter = __get_app_filter_or_error(user_id, interactive) app_filter = __get_app_filter_or_error(user_id, interactive)
@ -335,8 +335,9 @@ def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description='Query and update parental controls.') description='Query and update parental controls.')
subparsers = parser.add_subparsers(metavar='command', subparsers = parser.add_subparsers(metavar='command',
help='command to run (default: get)') help='command to run (default: '
parser.set_defaults(function=command_get) 'get-app-filter)')
parser.set_defaults(function=command_get_app_filter)
parser.add_argument('-q', '--quiet', action='store_true', parser.add_argument('-q', '--quiet', action='store_true',
help='output no informational messages') help='output no informational messages')
parser.set_defaults(quiet=False) parser.set_defaults(quiet=False)
@ -353,14 +354,16 @@ def main():
help='opposite of --no-interactive') help='opposite of --no-interactive')
common_parser.set_defaults(interactive=True) common_parser.set_defaults(interactive=True)
# get command # get-app-filter command
parser_get = subparsers.add_parser('get', parents=[common_parser], parser_get_app_filter = \
help='get current parental controls ' subparsers.add_parser('get-app-filter',
'settings') parents=[common_parser],
parser_get.set_defaults(function=command_get) help='get current app filter settings')
parser_get.add_argument('user', default='', nargs='?', parser_get_app_filter.set_defaults(function=command_get_app_filter)
help='user ID or username to get the app filter ' parser_get_app_filter.add_argument('user', default='', nargs='?',
'for (default: current user)') help='user ID or username to get the '
'app filter for (default: current '
'user)')
# monitor command # monitor command
parser_monitor = subparsers.add_parser('monitor', parser_monitor = subparsers.add_parser('monitor',