format options for every output!

This commit is contained in:
Linus Dierheimer
2021-03-19 20:57:07 +01:00
parent 5c6bbbf677
commit 1ceb5c91ac
34 changed files with 1500 additions and 695 deletions
+27 -9
View File
@@ -12,20 +12,38 @@ void ffPrintShell(FFinstance* instance)
return;
}
char* value;
char empty[1];
empty[0] = '\0';
if(!instance->config.shellShowPath)
char* shellName = strrchr(shellPath, '/');
if(shellName == NULL)
{
char* shellName = strrchr(shellPath, '/');
if(shellName != NULL)
value = ++shellName;
else
value = shellPath;
shellName = shellPath;
shellPath = empty;
}
else
{
value = shellPath;
*shellName = '\0';
++shellName;
}
ffPrintAndSaveCachedValue(instance, "Shell", value);
ffPrintLogoAndKey(instance, "Shell");
FFstrbuf shell;
ffStrbufInit(&shell);
if(!ffStrbufIsEmpty(&instance->config.shellFormat))
{
ffParseFormatString(&shell, &instance->config.shellFormat, 2,
(FFformatarg){FF_FORMAT_ARG_TYPE_STRING, shellPath},
(FFformatarg){FF_FORMAT_ARG_TYPE_STRING, shellName}
);
}
else
{
ffStrbufSetS(&shell, shellName);
}
ffPrintAndSaveCachedValue(instance, "Shell", shell.chars);
ffStrbufDestroy(&shell);
}