Skip to content

Commit fe3d38e

Browse files
committed
Logo: trait - as an alias for /dev/stdin
which can be useful where `/dev/stdin` is not available, eg. on Windows
1 parent f19a3b5 commit fe3d38e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/fastfetch.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,8 @@ static void parseArguments(FFdata* data, int argc, const char** argv)
12051205
}
12061206

12071207
if(i == argc - 1 || (
1208-
*argv[i + 1] == '-' &&
1208+
argv[i + 1][0] == '-' &&
1209+
argv[i + 1][1] != '\0' && // `-` is used as an alias for `/dev/stdin`
12091210
strcasecmp(argv[i], "--separator-string") != 0 // Separator string can start with a -
12101211
)) {
12111212
parseOption(data, argv[i], NULL);

src/logo/logo.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,10 @@ static bool logoPrintFileIfExists(bool doColorReplacement, bool raw)
359359

360360
FF_STRBUF_AUTO_DESTROY content = ffStrbufCreate();
361361

362-
if(!ffAppendFileBuffer(options->source.chars, &content))
362+
if(ffStrbufEqualS(&options->source, "-")
363+
? !ffAppendFDBuffer(FFUnixFD2NativeFD(STDIN_FILENO), &content)
364+
: !ffAppendFileBuffer(options->source.chars, &content)
365+
)
363366
{
364367
fprintf(stderr, "Logo: Failed to load file content from logo source: %s \n", options->source.chars);
365368
return false;

0 commit comments

Comments
 (0)