Skip to content

Commit 6b81223

Browse files
Print the last element of the default structure
#283
1 parent 488986e commit 6b81223

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trim_trailing_whitespace = true
1010
[*.{md,fflogo}]
1111
trim_trailing_whitespace = false
1212

13-
[*.{txt,fflogo}]
13+
[*.{fflogo}]
1414
insert_final_newline = false
1515

1616
[*.yml]

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.7.4
2+
3+
The last element in the default structure (currently the color blocks) is now printed again (#283)
4+
15
# 1.7.3
26

37
A lot of small improvements for MacOS & BSD platforms.

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
22

33
project(fastfetch
4-
VERSION 1.7.3
4+
VERSION 1.7.4
55
LANGUAGES C
66
DESCRIPTION "Fast system information tool"
77
HOMEPAGE_URL "https://github.com/LinusDierheimer/fastfetch"
@@ -155,9 +155,10 @@ endif()
155155

156156
function(fastfetch_load_text FILENAME OUTVAR)
157157
file(READ "${FILENAME}" TEMP)
158-
string(REPLACE "\n" "\\n" TEMP "${TEMP}")
159-
string(REPLACE "\"" "\\\"" TEMP "${TEMP}")
160-
string(REPLACE "$\\" "" TEMP "${TEMP}")
158+
string(REGEX REPLACE "\n$" "" TEMP "${TEMP}") # Remove trailing newline
159+
string(REPLACE "\n" "\\n" TEMP "${TEMP}") # Replace newlines with \n
160+
string(REPLACE "\"" "\\\"" TEMP "${TEMP}") # Replace quotes with \"
161+
string(REPLACE "$\\" "" TEMP "${TEMP}") # Remove $\, so we can unescape some things
161162
set("${OUTVAR}" "${TEMP}" PARENT_SCOPE)
162163
endfunction(fastfetch_load_text)
163164

src/fastfetch.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -769,12 +769,12 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
769769
}
770770
else if(strcasecmp(key, "--print-config-system") == 0)
771771
{
772-
fputs(FASTFETCH_DATATEXT_CONFIG_SYSTEM, stdout);
772+
puts(FASTFETCH_DATATEXT_CONFIG_SYSTEM);
773773
exit(0);
774774
}
775775
else if(strcasecmp(key, "--print-config-user") == 0)
776776
{
777-
fputs(FASTFETCH_DATATEXT_CONFIG_USER, stdout);
777+
puts(FASTFETCH_DATATEXT_CONFIG_USER);
778778
exit(0);
779779
}
780780
else if(strcasecmp(key, "--print-structure") == 0)
@@ -784,7 +784,7 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
784784
}
785785
else if(strcasecmp(key, "--list-modules") == 0)
786786
{
787-
fputs(FASTFETCH_DATATEXT_MODULES, stdout);
787+
puts(FASTFETCH_DATATEXT_MODULES);
788788
exit(0);
789789
}
790790
else if(strcasecmp(key, "--list-presets") == 0)
@@ -1464,18 +1464,14 @@ int main(int argc, const char** argv)
14641464
if(data.structure.length == 0)
14651465
ffStrbufAppendS(&data.structure, FASTFETCH_DATATEXT_STRUCTURE);
14661466

1467-
#define FF_CONTAINS_MODULE_NAME(moduleName)\
1468-
ffStrbufContainIgnCaseS(&data.structure, ":" #moduleName ":") ||\
1469-
ffStrbufStartsWithIgnCaseS(&data.structure, #moduleName ":") ||\
1470-
ffStrbufEndsWithIgnCaseS(&data.structure, ":" #moduleName)
1471-
1472-
if(FF_CONTAINS_MODULE_NAME(CPUUsage))
1467+
if(ffStrbufContainIgnCaseS(&data.structure, "CPUUsage"))
14731468
ffPrepareCPUUsage();
1474-
if(FF_CONTAINS_MODULE_NAME(PublicIp))
1469+
1470+
if(ffStrbufContainIgnCaseS(&data.structure, "PublicIp"))
14751471
ffPreparePublicIp(&instance);
1476-
if(FF_CONTAINS_MODULE_NAME(Weather))
1472+
1473+
if(ffStrbufContainIgnCaseS(&data.structure, "Weather"))
14771474
ffPrepareWeather(&instance);
1478-
#undef FF_CONTAINS_MODULE_NAME
14791475

14801476
ffStart(&instance);
14811477

0 commit comments

Comments
 (0)