In addition to 'nmcli connection help', you can now use: nmcli con up help nmcli con down help nmcli dev wifi help etc. The help option can also be in the form of --help/-h, or even shortened. https://bugzilla.gnome.org/show_bug.cgi?id=698237 https://bugzilla.redhat.com/show_bug.cgi?id=1034119
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* (C) Copyright 2010 - 2013 Red Hat, Inc.
|
* (C) Copyright 2010 - 2014 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -252,9 +252,9 @@ static void
|
|||||||
usage (void)
|
usage (void)
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("Usage: nmcli connection { COMMAND | help }\n"
|
_("Usage: nmcli connection { COMMAND | help }\n\n"
|
||||||
"COMMAND := { show | up | down | add | modify | edit | delete | reload | load }\n\n"
|
"COMMAND := { show | up | down | add | modify | edit | delete | reload | load }\n\n"
|
||||||
" show configured [[ id | uuid | path ] <ID>]\n\n"
|
" show configured [[id | uuid | path] <ID>]\n"
|
||||||
" show active [[id | uuid | path | apath] <ID>]\n\n"
|
" show active [[id | uuid | path | apath] <ID>]\n\n"
|
||||||
#if WITH_WIMAX
|
#if WITH_WIMAX
|
||||||
" up [[id | uuid | path] <ID>] [ifname <ifname>] [ap <BSSID>] [nsp <name>]\n\n"
|
" up [[id | uuid | path] <ID>] [ifname <ifname>] [ap <BSSID>] [nsp <name>]\n\n"
|
||||||
@@ -264,19 +264,73 @@ usage (void)
|
|||||||
" down [id | uuid | path | apath] <ID>\n\n"
|
" down [id | uuid | path | apath] <ID>\n\n"
|
||||||
" add COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS IP_OPTIONS\n\n"
|
" add COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS IP_OPTIONS\n\n"
|
||||||
" modify [id | uuid | path] <ID> <setting>.<property> <value>\n\n"
|
" modify [id | uuid | path] <ID> <setting>.<property> <value>\n\n"
|
||||||
" edit [ id | uuid | path ] <ID> | [type <new_con_type>] [con-name <new_con_name>]\n\n"
|
" edit [id | uuid | path] <ID>\n"
|
||||||
|
" edit [type <new_con_type>] [con-name <new_con_name>]\n\n"
|
||||||
" delete [id | uuid | path] <ID>\n\n"
|
" delete [id | uuid | path] <ID>\n\n"
|
||||||
" reload\n\n"
|
" reload\n\n"
|
||||||
" load <filename> [ <filename>... ]\n\n\n"
|
" load <filename> [ <filename>... ]\n\n"));
|
||||||
));
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_connection_show (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli connection show { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := active [[id | uuid | path | apath] <ID>]\n"
|
||||||
|
"\n"
|
||||||
|
"Show connections which are currently used by a device to connect to a network.\n"
|
||||||
|
"Without a parameter, all active connections are listed. When <ID> is provided,\n"
|
||||||
|
"the connection details are displayed instead.\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := configured [[id | uuid | path] <ID>]\n"
|
||||||
|
"\n"
|
||||||
|
"Show in-memory and on-disk connections, some of which may also be active if\n"
|
||||||
|
"a device is using that connection profile. Without a parameter, all profiles\n"
|
||||||
|
"are listed. When <ID> is provided, the profile details are displayed instead.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_connection_up (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli connection up { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [id | uuid | path] <ID> [ifname <ifname>] [ap <BSSID>] [nsp <name>]\n"
|
||||||
|
"\n"
|
||||||
|
"Activate a connection on a device. The profile to activate is identified by its\n"
|
||||||
|
"name, UUID or D-Bus path.\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := ifname <ifname> [ap <BSSID>] [nsp <name>]\n"
|
||||||
|
"\n"
|
||||||
|
"Activate a device with a connection. The connection profile is selected\n"
|
||||||
|
"automatically by NetworkManager.\n"
|
||||||
|
"\n"
|
||||||
|
"ifname - specifies the device to active the connection on\n"
|
||||||
|
"ap - specifies AP to connect to (only valid for Wi-Fi)\n"
|
||||||
|
"nsp - specifies NSP to connect to (only valid for WiMAX)\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_connection_down (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli connection down { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [id | uuid | path | apath] <ID>\n"
|
||||||
|
"\n"
|
||||||
|
"Deactivate a connection from a device (without preventing the device from\n"
|
||||||
|
"further auto-activation). The profile to deactivate is identified by its name,\n"
|
||||||
|
"UUID or D-Bus path.\n\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage_connection_add (void)
|
usage_connection_add (void)
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("Usage: nmcli connection add { OPTIONS | help }\n"
|
_("Usage: nmcli connection add { ARGUMENTS | help }\n"
|
||||||
" OPTIONS := COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS IP_OPTIONS\n\n"
|
"\n"
|
||||||
|
"ARGUMENTS := COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS IP_OPTIONS\n\n"
|
||||||
" COMMON_OPTIONS:\n"
|
" COMMON_OPTIONS:\n"
|
||||||
" type <type>\n"
|
" type <type>\n"
|
||||||
" ifname <interface name> | \"*\"\n"
|
" ifname <interface name> | \"*\"\n"
|
||||||
@@ -344,10 +398,72 @@ usage_connection_add (void)
|
|||||||
" [dhcp-anycast <MAC address>]\n\n"
|
" [dhcp-anycast <MAC address>]\n\n"
|
||||||
" IP_OPTIONS:\n"
|
" IP_OPTIONS:\n"
|
||||||
" [ip4 <IPv4 address>] [gw4 <IPv4 gateway>]\n"
|
" [ip4 <IPv4 address>] [gw4 <IPv4 gateway>]\n"
|
||||||
" [ip6 <IPv6 address>] [gw6 <IPv6 gateway>]\n"
|
" [ip6 <IPv6 address>] [gw6 <IPv6 gateway>]\n\n"));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_connection_modify (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli connection modify { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [id | uuid | path] <ID> <setting name>.<property name> [<value>]\n"
|
||||||
|
"\n"
|
||||||
|
"Modify a single property in the connection profile.\n"
|
||||||
|
"The profile is identified by its name, UUID or D-Bus path.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_connection_edit (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli connection edit { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [id | uuid | path] <ID>\n"
|
||||||
|
"\n"
|
||||||
|
"Edit an existing connection profile in an interactive editor.\n"
|
||||||
|
"The profile is identified by its name, UUID or D-Bus path\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [type <new connection type>] [con-name <new connection name>]\n"
|
||||||
|
"\n"
|
||||||
|
"Add a new connection profile in an interactive editor.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_connection_delete (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli connection delete { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [id | uuid | path] <ID>\n"
|
||||||
|
"\n"
|
||||||
|
"Delete a connection profile.\n"
|
||||||
|
"The profile is identified by its name, UUID or D-Bus path.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_connection_reload (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli connection reload { help }\n"
|
||||||
|
"\n"
|
||||||
|
"Reload all connection files from disk.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_connection_load (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli connection load { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := <filename> [<filename>...]\n"
|
||||||
|
"\n"
|
||||||
|
"Load/reload one or more connection files from disk. Use this after manually\n"
|
||||||
|
"editing a connection file to ensure that NetworkManager is aware of its latest\n"
|
||||||
|
"state.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* The real commands that do something - i.e. not 'help', etc. */
|
/* The real commands that do something - i.e. not 'help', etc. */
|
||||||
static const char *real_con_commands[] = {
|
static const char *real_con_commands[] = {
|
||||||
"show",
|
"show",
|
||||||
@@ -7722,9 +7838,13 @@ parse_cmd (NmCli *nmc, int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
if (nmc_arg_is_help (*argv)) {
|
if (nmc_arg_is_help (*argv)) {
|
||||||
usage ();
|
usage ();
|
||||||
nmc->should_wait = FALSE;
|
goto usage_exit;
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "show") == 0) {
|
else if (matches (*argv, "show") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_connection_show ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
arg_ret = next_arg (&argc, &argv);
|
arg_ret = next_arg (&argc, &argv);
|
||||||
if (arg_ret != 0 || matches (*argv, "configured") == 0) {
|
if (arg_ret != 0 || matches (*argv, "configured") == 0) {
|
||||||
next_arg (&argc, &argv);
|
next_arg (&argc, &argv);
|
||||||
@@ -7740,19 +7860,31 @@ parse_cmd (NmCli *nmc, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (matches(*argv, "up") == 0) {
|
else if (matches(*argv, "up") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_connection_up ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
nmc->return_value = do_connection_up (nmc, argc-1, argv+1);
|
nmc->return_value = do_connection_up (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
else if (matches(*argv, "down") == 0) {
|
else if (matches(*argv, "down") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_connection_down ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
nmc->return_value = do_connection_down (nmc, argc-1, argv+1);
|
nmc->return_value = do_connection_down (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
else if (matches(*argv, "add") == 0) {
|
else if (matches(*argv, "add") == 0) {
|
||||||
if (nmc_arg_is_help (*(argv+1))) {
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
usage_connection_add ();
|
usage_connection_add ();
|
||||||
nmc->should_wait = FALSE;
|
goto usage_exit;
|
||||||
} else
|
}
|
||||||
nmc->return_value = do_connection_add (nmc, argc-1, argv+1);
|
nmc->return_value = do_connection_add (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
else if (matches(*argv, "edit") == 0) {
|
else if (matches(*argv, "edit") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_connection_edit ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
editor_thread_data.nmc = nmc;
|
editor_thread_data.nmc = nmc;
|
||||||
editor_thread_data.argc = argc - 1;
|
editor_thread_data.argc = argc - 1;
|
||||||
editor_thread_data.argv = argv + 1;
|
editor_thread_data.argv = argv + 1;
|
||||||
@@ -7760,15 +7892,31 @@ parse_cmd (NmCli *nmc, int argc, char **argv)
|
|||||||
g_thread_unref (editor_thread);
|
g_thread_unref (editor_thread);
|
||||||
}
|
}
|
||||||
else if (matches(*argv, "delete") == 0) {
|
else if (matches(*argv, "delete") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_connection_delete ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
nmc->return_value = do_connection_delete (nmc, argc-1, argv+1);
|
nmc->return_value = do_connection_delete (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
else if (matches(*argv, "reload") == 0) {
|
else if (matches(*argv, "reload") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_connection_reload ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
nmc->return_value = do_connection_reload (nmc, argc-1, argv+1);
|
nmc->return_value = do_connection_reload (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
else if (matches(*argv, "load") == 0) {
|
else if (matches(*argv, "load") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_connection_load ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
nmc->return_value = do_connection_load (nmc, argc-1, argv+1);
|
nmc->return_value = do_connection_load (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "modify") == 0) {
|
else if (matches (*argv, "modify") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_connection_modify ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
nmc->return_value = do_connection_modify (nmc, argc-1, argv+1);
|
nmc->return_value = do_connection_modify (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -7781,6 +7929,10 @@ parse_cmd (NmCli *nmc, int argc, char **argv)
|
|||||||
|
|
||||||
return nmc->return_value;
|
return nmc->return_value;
|
||||||
|
|
||||||
|
usage_exit:
|
||||||
|
nmc->should_wait = FALSE;
|
||||||
|
return nmc->return_value;
|
||||||
|
|
||||||
opt_error:
|
opt_error:
|
||||||
g_string_printf (nmc->return_text, _("Error: %s."), error->message);
|
g_string_printf (nmc->return_text, _("Error: %s."), error->message);
|
||||||
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* (C) Copyright 2010 - 2013 Red Hat, Inc.
|
* (C) Copyright 2010 - 2014 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -282,8 +282,8 @@ usage (void)
|
|||||||
" connect <ifname>\n\n"
|
" connect <ifname>\n\n"
|
||||||
" disconnect <ifname>\n\n"
|
" disconnect <ifname>\n\n"
|
||||||
" wifi [list [ifname <ifname>] [bssid <BSSID>]]\n\n"
|
" wifi [list [ifname <ifname>] [bssid <BSSID>]]\n\n"
|
||||||
" wifi connect <(B)SSID> [password <password>] [wep-key-type key|phrase] [ifname <ifname>] [bssid <BSSID>] [name <name>]\n\n"
|
" wifi connect <(B)SSID> [password <password>] [wep-key-type key|phrase] [ifname <ifname>]\n"
|
||||||
" [private yes|no]\n\n"
|
" [bssid <BSSID>] [name <name>] [private yes|no]\n\n"
|
||||||
" wifi rescan [[ifname] <ifname>]\n\n"
|
" wifi rescan [[ifname] <ifname>]\n\n"
|
||||||
#if WITH_WIMAX
|
#if WITH_WIMAX
|
||||||
" wimax [list [ifname <ifname>] [nsp <name>]]\n\n"
|
" wimax [list [ifname <ifname>] [nsp <name>]]\n\n"
|
||||||
@@ -291,6 +291,109 @@ usage (void)
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_device_status (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli device status { help }\n"
|
||||||
|
"\n"
|
||||||
|
"Show status for all devices.\n"
|
||||||
|
"By default, the following columns are shown:\n"
|
||||||
|
" DEVICE - interface name\n"
|
||||||
|
" TYPE - device type\n"
|
||||||
|
" STATE - device state\n"
|
||||||
|
" CONNECTION - connection activated on device (if any)\n"
|
||||||
|
"Displayed columns can be changed using '--fields' global option. 'status' is\n"
|
||||||
|
"the default command, which means 'nmcli device' calls 'nmcli device status'.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_device_show (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli device show { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [<ifname>]\n"
|
||||||
|
"\n"
|
||||||
|
"Show details of device(s).\n"
|
||||||
|
"The command lists details for all devices, or for a given device.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_device_connect (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli device connect { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := <ifname>\n"
|
||||||
|
"\n"
|
||||||
|
"Connect the device.\n"
|
||||||
|
"NetworkManager will try to find a suitable connection that will be activated.\n"
|
||||||
|
"It will also consider connections that are not set to auto-connect.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_device_disconnect (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli device disconnect { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := <ifname>\n"
|
||||||
|
"\n"
|
||||||
|
"Disconnect the device.\n"
|
||||||
|
"The command disconnects the device and prevents it from auto-activating\n"
|
||||||
|
"further connections without user/manual intervention.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_device_wifi (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli device wifi { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"Perform operation on Wi-Fi devices.\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [list [ifname <ifname>] [bssid <BSSID>]]\n"
|
||||||
|
"\n"
|
||||||
|
"List available Wi-Fi access points. The 'ifname' and 'bssid' options can be\n"
|
||||||
|
"used to list APs for a particular interface, or with a specific BSSID.\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := connect <(B)SSID> [password <password>] [wep-key-type key|phrase] [ifname <ifname>]\n"
|
||||||
|
" [bssid <BSSID>] [name <name>] [private yes|no]\n"
|
||||||
|
"\n"
|
||||||
|
"Connect to a Wi-Fi network specified by SSID or BSSID. The command creates\n"
|
||||||
|
"a new connection and then activates it on a device. This is a command-line\n"
|
||||||
|
"counterpart of clicking an SSID in a GUI client. The command always creates\n"
|
||||||
|
"a new connection and thus it is mainly useful for connecting to new Wi-Fi\n"
|
||||||
|
"networks. If a connection for the network already exists, it is better to\n"
|
||||||
|
"bring up the existing profile as follows: nmcli con up id <name>. Note that\n"
|
||||||
|
"only open, WEP and WPA-PSK networks are supported at the moment. It is also\n"
|
||||||
|
"assumed that IP configuration is obtained via DHCP.\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := rescan [[ifname] <ifname>]\n"
|
||||||
|
"\n"
|
||||||
|
"Request that NetworkManager immediately re-scan for available access points.\n"
|
||||||
|
"NetworkManager scans Wi-Fi networks periodically, but in some cases it might\n"
|
||||||
|
"be useful to start scanning manually. Note that this command does not show\n"
|
||||||
|
"the APs, use 'nmcli device wifi list' for that.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if WITH_WIMAX
|
||||||
|
static void
|
||||||
|
usage_device_wimax (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli device wimax { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"Perform operation on WiMAX devices.\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [list [ifname <ifname>] [nsp <name>]]\n"
|
||||||
|
"\n"
|
||||||
|
"List available WiMAX NSPs. The 'ifname' and 'nsp' options can be used to\n"
|
||||||
|
"list networks for a particular interface, or with a specific NSP.\n\n"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* quit main loop */
|
/* quit main loop */
|
||||||
static void
|
static void
|
||||||
quit (void)
|
quit (void)
|
||||||
@@ -2454,30 +2557,55 @@ do_devices (NmCli *nmc, int argc, char **argv)
|
|||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
if (nmc_arg_is_help (*argv)) {
|
if (nmc_arg_is_help (*argv)) {
|
||||||
usage ();
|
usage ();
|
||||||
|
goto usage_exit;
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "status") == 0) {
|
else if (matches (*argv, "status") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_device_status ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error))
|
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error))
|
||||||
goto opt_error;
|
goto opt_error;
|
||||||
nmc->return_value = do_devices_status (nmc, argc-1, argv+1);
|
nmc->return_value = do_devices_status (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "show") == 0) {
|
else if (matches (*argv, "show") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_device_show ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
if (!nmc->mode_specified)
|
if (!nmc->mode_specified)
|
||||||
nmc->multiline_output = TRUE; /* multiline mode is default for 'device show' */
|
nmc->multiline_output = TRUE; /* multiline mode is default for 'device show' */
|
||||||
nmc->return_value = do_devices_show (nmc, argc-1, argv+1);
|
nmc->return_value = do_devices_show (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "connect") == 0) {
|
else if (matches (*argv, "connect") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_device_connect ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
nmc->return_value = do_device_connect (nmc, argc-1, argv+1);
|
nmc->return_value = do_device_connect (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "disconnect") == 0) {
|
else if (matches (*argv, "disconnect") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_device_disconnect ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
nmc->return_value = do_device_disconnect (nmc, argc-1, argv+1);
|
nmc->return_value = do_device_disconnect (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "wifi") == 0) {
|
else if (matches (*argv, "wifi") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_device_wifi ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error))
|
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error))
|
||||||
goto opt_error;
|
goto opt_error;
|
||||||
nmc->return_value = do_device_wifi (nmc, argc-1, argv+1);
|
nmc->return_value = do_device_wifi (nmc, argc-1, argv+1);
|
||||||
}
|
}
|
||||||
#if WITH_WIMAX
|
#if WITH_WIMAX
|
||||||
else if (matches (*argv, "wimax") == 0) {
|
else if (matches (*argv, "wimax") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_device_wimax ();
|
||||||
|
goto usage_exit;
|
||||||
|
}
|
||||||
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error))
|
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error))
|
||||||
goto opt_error;
|
goto opt_error;
|
||||||
nmc->return_value = do_device_wimax (nmc, argc-1, argv+1);
|
nmc->return_value = do_device_wimax (nmc, argc-1, argv+1);
|
||||||
@@ -2490,6 +2618,7 @@ do_devices (NmCli *nmc, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usage_exit:
|
||||||
return nmc->return_value;
|
return nmc->return_value;
|
||||||
|
|
||||||
opt_error:
|
opt_error:
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* (C) Copyright 2010 - 2013 Red Hat, Inc.
|
* (C) Copyright 2010 - 2014 Red Hat, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -97,8 +97,53 @@ usage_general (void)
|
|||||||
" status\n\n"
|
" status\n\n"
|
||||||
" hostname [<hostname>]\n\n"
|
" hostname [<hostname>]\n\n"
|
||||||
" permissions\n\n"
|
" permissions\n\n"
|
||||||
" logging [level <log level>] [domains <log domains>]\n\n"
|
" logging [level <log level>] [domains <log domains>]\n\n"));
|
||||||
));
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_general_status (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli general status { help }\n"
|
||||||
|
"\n"
|
||||||
|
"Show overall status of NetworkManager.\n"
|
||||||
|
"'status' is the default action, which means 'nmcli gen' calls 'nmcli gen status'\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_general_hostname (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli general hostname { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [<hostname>]\n"
|
||||||
|
"\n"
|
||||||
|
"Get or change persistent system hostname.\n"
|
||||||
|
"With no arguments, this prints currently configured hostname. When you pass\n"
|
||||||
|
"a hostname, NetworkManager will set it as the new persistent system hostname.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_general_permissions (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli general permissions { help }\n"
|
||||||
|
"\n"
|
||||||
|
"Show caller permissions for authenticated operations.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_general_logging (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli general logging { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [level <log level>] [domains <log domains>]\n"
|
||||||
|
"\n"
|
||||||
|
"Get or change NetworkManager logging level and domains.\n"
|
||||||
|
"Without any argument current logging level and domains are shown. In order to\n"
|
||||||
|
"change logging state, provide level and/or domain. Please refer to the man page\n"
|
||||||
|
"for the list of possible logging domains.\n\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -106,11 +151,41 @@ usage_networking (void)
|
|||||||
{
|
{
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("Usage: nmcli networking { COMMAND | help }\n\n"
|
_("Usage: nmcli networking { COMMAND | help }\n\n"
|
||||||
" COMMAND := { on | off | connectivity }\n\n"
|
"COMMAND := { [ on | off | connectivity ] }\n\n"
|
||||||
" on\n\n"
|
" on\n\n"
|
||||||
" off\n\n"
|
" off\n\n"
|
||||||
" connectivity [check]\n\n"
|
" connectivity [check]\n\n"));
|
||||||
));
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_networking_on (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli networking on { help }\n"
|
||||||
|
"\n"
|
||||||
|
"Switch networking on.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_networking_off (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli networking off { help }\n"
|
||||||
|
"\n"
|
||||||
|
"Switch networking off.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_networking_connectivity (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli networking connectivity { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [check]\n"
|
||||||
|
"\n"
|
||||||
|
"Get network connectivity state.\n"
|
||||||
|
"The optional 'check' argument makes NetworkManager re-check the connectivity.\n\n"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -128,6 +203,52 @@ usage_radio (void)
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_radio_all (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli radio all { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [on | off]\n"
|
||||||
|
"\n"
|
||||||
|
"Get status of all radio switches, or turn them on/off.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_radio_wifi (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli radio wifi { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [on | off]\n"
|
||||||
|
"\n"
|
||||||
|
"Get status of Wi-Fi radio switch, or turn it on/off.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_radio_wwan (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli radio wwan { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [on | off]\n"
|
||||||
|
"\n"
|
||||||
|
"Get status of mobile broadband radio switch, or turn it on/off.\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if WITH_WIMAX
|
||||||
|
static void
|
||||||
|
usage_radio_wimax (void)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
_("Usage: nmcli radio wimax { ARGUMENTS | help }\n"
|
||||||
|
"\n"
|
||||||
|
"ARGUMENTS := [on | off]\n"
|
||||||
|
"\n"
|
||||||
|
"Get status of WiMAX radio switch, or turn it on/off.\n\n"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* quit main loop */
|
/* quit main loop */
|
||||||
static void
|
static void
|
||||||
quit (void)
|
quit (void)
|
||||||
@@ -470,6 +591,10 @@ do_general (NmCli *nmc, int argc, char **argv)
|
|||||||
usage_general ();
|
usage_general ();
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "status") == 0) {
|
else if (matches (*argv, "status") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_general_status ();
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error)) {
|
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error)) {
|
||||||
g_string_printf (nmc->return_text, _("Error: %s."), error->message);
|
g_string_printf (nmc->return_text, _("Error: %s."), error->message);
|
||||||
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
||||||
@@ -480,6 +605,11 @@ do_general (NmCli *nmc, int argc, char **argv)
|
|||||||
else if (matches (*argv, "hostname") == 0) {
|
else if (matches (*argv, "hostname") == 0) {
|
||||||
NMRemoteSettings *rem_settings;
|
NMRemoteSettings *rem_settings;
|
||||||
|
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_general_hostname ();
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
|
||||||
/* get system settings */
|
/* get system settings */
|
||||||
if (!(rem_settings = nm_remote_settings_new (NULL))) {
|
if (!(rem_settings = nm_remote_settings_new (NULL))) {
|
||||||
g_string_printf (nmc->return_text, _("Error: Could not get system settings."));
|
g_string_printf (nmc->return_text, _("Error: Could not get system settings."));
|
||||||
@@ -507,6 +637,10 @@ do_general (NmCli *nmc, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "permissions") == 0) {
|
else if (matches (*argv, "permissions") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_general_permissions ();
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error)) {
|
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error)) {
|
||||||
g_string_printf (nmc->return_text, _("Error: %s."), error->message);
|
g_string_printf (nmc->return_text, _("Error: %s."), error->message);
|
||||||
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
||||||
@@ -515,6 +649,10 @@ do_general (NmCli *nmc, int argc, char **argv)
|
|||||||
show_nm_permissions (nmc);
|
show_nm_permissions (nmc);
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "logging") == 0) {
|
else if (matches (*argv, "logging") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_general_logging ();
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
if (next_arg (&argc, &argv) != 0) {
|
if (next_arg (&argc, &argv) != 0) {
|
||||||
/* no arguments -> get logging level and domains */
|
/* no arguments -> get logging level and domains */
|
||||||
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error)) {
|
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error)) {
|
||||||
@@ -622,6 +760,10 @@ do_networking (NmCli *nmc, int argc, char **argv)
|
|||||||
if (nmc_arg_is_help (*argv)) {
|
if (nmc_arg_is_help (*argv)) {
|
||||||
usage_networking ();
|
usage_networking ();
|
||||||
} else if (matches (*argv, "connectivity") == 0) {
|
} else if (matches (*argv, "connectivity") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_networking_connectivity ();
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
if (next_arg (&argc, &argv) != 0) {
|
if (next_arg (&argc, &argv) != 0) {
|
||||||
/* no arguments -> get current state */
|
/* no arguments -> get current state */
|
||||||
show_networking_connectivity (nmc);
|
show_networking_connectivity (nmc);
|
||||||
@@ -642,6 +784,13 @@ do_networking (NmCli *nmc, int argc, char **argv)
|
|||||||
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
||||||
}
|
}
|
||||||
} else if (nmc_switch_parse_on_off (nmc, *(argv-1), *argv, &enable_flag)) {
|
} else if (nmc_switch_parse_on_off (nmc, *(argv-1), *argv, &enable_flag)) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
if (enable_flag)
|
||||||
|
usage_networking_on ();
|
||||||
|
else
|
||||||
|
usage_networking_off ();
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
|
||||||
nmc->get_client (nmc); /* create NMClient */
|
nmc->get_client (nmc); /* create NMClient */
|
||||||
nm_client_networking_set_enabled (nmc->client, enable_flag);
|
nm_client_networking_set_enabled (nmc->client, enable_flag);
|
||||||
@@ -652,6 +801,7 @@ do_networking (NmCli *nmc, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finish:
|
||||||
quit ();
|
quit ();
|
||||||
return nmc->return_value;
|
return nmc->return_value;
|
||||||
}
|
}
|
||||||
@@ -680,6 +830,10 @@ do_radio (NmCli *nmc, int argc, char **argv)
|
|||||||
usage_radio ();
|
usage_radio ();
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "all") == 0) {
|
else if (matches (*argv, "all") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_radio_all ();
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
if (next_arg (&argc, &argv) != 0) {
|
if (next_arg (&argc, &argv) != 0) {
|
||||||
/* no argument, show all radio switches */
|
/* no argument, show all radio switches */
|
||||||
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error)) {
|
if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error)) {
|
||||||
@@ -700,6 +854,10 @@ do_radio (NmCli *nmc, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "wifi") == 0) {
|
else if (matches (*argv, "wifi") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_radio_wifi ();
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
if (next_arg (&argc, &argv) != 0) {
|
if (next_arg (&argc, &argv) != 0) {
|
||||||
/* no argument, show current WiFi state */
|
/* no argument, show current WiFi state */
|
||||||
nmc_switch_show (nmc, NMC_FIELDS_NM_WIFI, _("Wi-Fi radio switch"));
|
nmc_switch_show (nmc, NMC_FIELDS_NM_WIFI, _("Wi-Fi radio switch"));
|
||||||
@@ -712,6 +870,10 @@ do_radio (NmCli *nmc, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (matches (*argv, "wwan") == 0) {
|
else if (matches (*argv, "wwan") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_radio_wwan ();
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
if (next_arg (&argc, &argv) != 0) {
|
if (next_arg (&argc, &argv) != 0) {
|
||||||
/* no argument, show current WWAN (mobile broadband) state */
|
/* no argument, show current WWAN (mobile broadband) state */
|
||||||
nmc_switch_show (nmc, NMC_FIELDS_NM_WWAN, _("WWAN radio switch"));
|
nmc_switch_show (nmc, NMC_FIELDS_NM_WWAN, _("WWAN radio switch"));
|
||||||
@@ -725,6 +887,10 @@ do_radio (NmCli *nmc, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#if WITH_WIMAX
|
#if WITH_WIMAX
|
||||||
else if (matches (*argv, "wimax") == 0) {
|
else if (matches (*argv, "wimax") == 0) {
|
||||||
|
if (nmc_arg_is_help (*(argv+1))) {
|
||||||
|
usage_radio_wimax ();
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
if (next_arg (&argc, &argv) != 0) {
|
if (next_arg (&argc, &argv) != 0) {
|
||||||
/* no argument, show current WiMAX state */
|
/* no argument, show current WiMAX state */
|
||||||
nmc_switch_show (nmc, NMC_FIELDS_NM_WIMAX, _("WiMAX radio switch"));
|
nmc_switch_show (nmc, NMC_FIELDS_NM_WIMAX, _("WiMAX radio switch"));
|
||||||
|
Reference in New Issue
Block a user