client: add WSC argument completers

This commit is contained in:
Tim Kourt 2017-05-01 10:23:46 -07:00 committed by Denis Kenzior
parent ccb3afc1f1
commit b1d261a790
4 changed files with 45 additions and 1 deletions

View File

@ -90,7 +90,7 @@ client_iwctl_SOURCES = client/main.c \
client/adapter.c \
client/command.h client/command.c \
client/dbus-proxy.h client/dbus-proxy.c \
client/device.c \
client/device.h client/device.c \
client/display.h client/display.c \
client/known-networks.c \
client/network.h client/network.c \

View File

@ -28,6 +28,7 @@
#include "command.h"
#include "dbus-proxy.h"
#include "device.h"
#include "display.h"
#include "network.h"
@ -624,6 +625,13 @@ static const struct command device_commands[] = {
{ }
};
char *device_wsc_family_arg_completion(const char *text, int state)
{
return proxy_property_str_completion(&device_interface_type,
match_by_partial_name, "Name",
text, state);
}
static char *family_arg_completion(const char *text, int state)
{
static bool first_pass;

23
client/device.h Normal file
View File

@ -0,0 +1,23 @@
/*
*
* Wireless daemon for Linux
*
* Copyright (C) 2017 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
char *device_wsc_family_arg_completion(const char *text, int state);

View File

@ -28,6 +28,7 @@
#include "command.h"
#include "dbus-proxy.h"
#include "device.h"
static struct proxy_interface_type wsc_interface_type = {
.interface = IWD_WSC_INTERFACE,
@ -63,10 +64,22 @@ static const struct command wsc_commands[] = {
{ }
};
static char *family_arg_completion(const char *text, int state)
{
return device_wsc_family_arg_completion(text, state);
}
static char *entity_arg_completion(const char *text, int state)
{
return command_entity_arg_completion(text, state, wsc_commands);
}
static struct command_family wsc_command_family = {
.caption = "WiFi Simple Configuration",
.name = "wsc",
.command_list = wsc_commands,
.family_arg_completion = family_arg_completion,
.entity_arg_completion = entity_arg_completion,
};
static int wsc_command_family_init(void)