]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- select table style based on codeset 871/head
authorArvin Schnell <aschnell@suse.de>
Fri, 16 Feb 2024 07:28:31 +0000 (08:28 +0100)
committerArvin Schnell <aschnell@suse.de>
Fri, 16 Feb 2024 07:28:31 +0000 (08:28 +0100)
client/GlobalOptions.cc
client/utils/TableFormatter.cc
client/utils/TableFormatter.h
package/snapper.changes

index eee8dc63bcfd64782f3abc37645201a564a02721..0c1d544b91a3e137bd591b8284a5f5da24b468bb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) [2019-2023] SUSE LLC
+ * Copyright (c) [2019-2024] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -122,7 +122,7 @@ namespace snapper
     {
        ParsedOpts::const_iterator it = opts.find("table-style");
        if (it == opts.end())
-           return TableFormatter::default_style;
+           return TableFormatter::default_style();
 
        try
        {
@@ -141,7 +141,7 @@ namespace snapper
            SN_THROW(OptionsException(error));
        }
 
-       return TableFormatter::default_style;
+       return TableFormatter::default_style();
     }
 
 
index 1f61431dd5b755607323bab074a9f82ff83948c0..a89032ff942c451d05526ae148486102465d2fdb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) [2019-2020] SUSE LLC
+ * Copyright (c) [2019-2024] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -20,6 +20,9 @@
  */
 
 
+#include <cstring>
+#include <langinfo.h>
+
 #include "client/utils/TableFormatter.h"
 
 
@@ -29,7 +32,11 @@ namespace snapper
     using namespace std;
 
 
-    const TableStyle TableFormatter::default_style = Ascii;
+    TableStyle
+    TableFormatter::default_style()
+    {
+       return strcmp(nl_langinfo(CODESET), "UTF-8") == 0 ? TableStyle::Light : TableStyle::Ascii;
+    }
 
 
     ostream&
index 16c079739fe6f47d9999af67d5ba5f9894340329..251bde89b81d8b574661938f75a7a44ecb04c20b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) [2019-2020] SUSE LLC
+ * Copyright (c) [2019-2024] SUSE LLC
  *
  * All Rights Reserved.
  *
@@ -41,7 +41,7 @@ namespace snapper
 
     public:
 
-       static const TableStyle default_style;
+       static TableStyle default_style();
 
        TableFormatter(TableStyle style) : style(style) {}
 
index 03a848c4a7fb55ba01efab8c57743488c4347c81..3f926863dc26f92e132e003ef2ca77b4c066138f 100644 (file)
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Fri Feb 16 08:26:41 CET 2024 - aschnell@suse.com
+
+- select table style based on codeset
+
 -------------------------------------------------------------------
 Wed Feb 14 09:14:32 CET 2024 - aschnell@suse.com