cli: add 'connect to SSID' feature: nmcli dev wifi connect <SSID> ...
This is similar to clicking a Wi-Fi network's SSID in a GUI applet. The command does this: - creates new connection (fills the user data specified via options, the connection is then completed with default parameters by NM) - and then activates the connection on a Wi-Fi device. WPA-Enterprise is not supported as it requires a plethora of parameters and they can't be obtained automatically. Also, the created connection uses 'auto' IP method, which means that if the Wi-Fi network doesn't support DHCP, the connection will albeit be created, however the activation will fail (IP configuration won't be available).
This commit is contained in:
@@ -136,6 +136,38 @@ nmc_ip6_address_as_string (const struct in6_addr *ip, GError **error)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Erase terminal line using ANSI escape sequences.
|
||||
* It prints <ESC>[2K sequence to erase the line and then \r to return back
|
||||
* to the beginning of the line.
|
||||
*
|
||||
* http://www.termsys.demon.co.uk/vtansi.htm
|
||||
*/
|
||||
void
|
||||
nmc_terminal_erase_line (void)
|
||||
{
|
||||
printf ("\33[2K\r");
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print animated progress for an operation.
|
||||
* Repeated calls of the function will show rotating slash in terminal followed
|
||||
* by the string passed in 'str' argument.
|
||||
*/
|
||||
void
|
||||
nmc_terminal_show_progress (const char *str)
|
||||
{
|
||||
static int idx = 0;
|
||||
const char slashes[4] = {'|', '/', '-', '\\'};
|
||||
|
||||
nmc_terminal_erase_line ();
|
||||
printf ("%c %s", slashes[idx++], str ? str : "");
|
||||
fflush (stdout);
|
||||
if (idx == 4)
|
||||
idx = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find out how many columns an UTF-8 string occupies on the screen
|
||||
*/
|
||||
|
Reference in New Issue
Block a user