merge: branch 'feature/configurable-nmcli-history-file'

nmcli: Move history file to `$XDG_CACHE_HOME`

Closes #1615

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2027
This commit is contained in:
Íñigo Huguet
2024-10-14 11:38:39 +00:00
2 changed files with 5 additions and 3 deletions

2
NEWS
View File

@@ -8,6 +8,8 @@ subject to change and not guaranteed to be compatible with
the later release. the later release.
USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE! USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
* Store interactive history in `$XDG_CACHE_HOME/nmcli-history` instead of
`~/.nmcli-history`
* Add new ipv4.link-local=fallback to set an IPv4 link-local address * Add new ipv4.link-local=fallback to set an IPv4 link-local address
when no other IPv4 is set. when no other IPv4 is set.
* Remove support for building with Autotools * Remove support for building with Autotools

View File

@@ -6913,7 +6913,7 @@ nmcli_editor_tab_completion(const char *text, int start, int end)
return match_array; return match_array;
} }
#define NMCLI_EDITOR_HISTORY ".nmcli-history" #define NMCLI_EDITOR_HISTORY "nmcli-history"
static void static void
load_history_cmds(const char *uuid) load_history_cmds(const char *uuid)
@@ -6925,7 +6925,7 @@ load_history_cmds(const char *uuid)
size_t i; size_t i;
GError *err = NULL; GError *err = NULL;
filename = g_build_filename(g_get_home_dir(), NMCLI_EDITOR_HISTORY, NULL); filename = g_build_filename(g_get_user_cache_dir(), NMCLI_EDITOR_HISTORY, NULL);
kf = g_key_file_new(); kf = g_key_file_new();
if (!g_key_file_load_from_file(kf, filename, G_KEY_FILE_KEEP_COMMENTS, &err)) { if (!g_key_file_load_from_file(kf, filename, G_KEY_FILE_KEEP_COMMENTS, &err)) {
if (g_error_matches(err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE)) if (g_error_matches(err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE))
@@ -6961,7 +6961,7 @@ save_history_cmds(const char *uuid)
if (!hist) if (!hist)
return; return;
filename = g_build_filename(g_get_home_dir(), NMCLI_EDITOR_HISTORY, NULL); filename = g_build_filename(g_get_user_cache_dir(), NMCLI_EDITOR_HISTORY, NULL);
kf = g_key_file_new(); kf = g_key_file_new();