Skip to content

Commit d10c147

Browse files
committed
Disk: be able to print disk indices
1 parent 4534f18 commit d10c147

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/modules/disk/disk.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define FF_DISK_NUM_FORMAT_ARGS 14
1111
#pragma GCC diagnostic ignored "-Wsign-conversion"
1212

13-
static void printDisk(FFDiskOptions* options, const FFDisk* disk)
13+
static void printDisk(FFDiskOptions* options, const FFDisk* disk, uint32_t index)
1414
{
1515
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
1616

@@ -35,11 +35,12 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
3535
}
3636
else
3737
{
38-
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 4, ((FFformatarg[]){
38+
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 5, ((FFformatarg[]){
3939
FF_FORMAT_ARG(disk->mountpoint, "mountpoint"),
4040
FF_FORMAT_ARG(disk->name, "name"),
4141
FF_FORMAT_ARG(disk->mountFrom, "mount-from"),
4242
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
43+
FF_FORMAT_ARG(index, "index"),
4344
}));
4445
}
4546

@@ -150,12 +151,13 @@ void ffPrintDisk(FFDiskOptions* options)
150151
}
151152
else
152153
{
154+
uint32_t index = 0;
153155
FF_LIST_FOR_EACH(FFDisk, disk, disks)
154156
{
155157
if(__builtin_expect(options->folders.length == 0, 1) && (disk->type & ~options->showTypes))
156158
continue;
157159

158-
printDisk(options, disk);
160+
printDisk(options, disk, ++index);
159161
}
160162
}
161163

0 commit comments

Comments
 (0)