blob: f8824ab645134118d283ecc8fc515f2a9d4f56d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/* SPDX-License-Identifier: GPL-3.0-or-later */
/*
* vfetch - neofetch but the ascii part is a video
*
* Copyright (C) 2026 Doan Luu Duc Tai
*
*/
#ifndef SRC__CONFIG_H
#define SRC__CONFIG_H
#include <glib.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "error.h"
typedef enum {
ARG_HANDLER_BOOLEAN,
ARG_HANDLER_CHAFA_MAP,
ARG_HANDLER_CHAFA_FLAG,
ARG_HANDLER_BOUNDED_FLOAT,
ARG_HANDLER_CUSTOM
} ArgHandlerType;
typedef struct VfetchArgs {
GHashTable *chafa_options;
gchar *filename;
gchar *colors_arg;
gchar *fetch_tool_arg;
gchar *fg_color_arg;
gchar *bg_color_arg;
gchar *format_arg;
double cell_aspect_ratio;
double fps;
uint32_t width;
uint32_t height;
uint32_t pad_x;
uint32_t pad_y;
uint32_t num_frames;
uint16_t refresh_rate;
bool audio;
bool loop;
bool debug;
bool verbose;
} VfetchArgs;
typedef struct BoundedFloatData {
size_t offset;
float min;
float max;
} BoundedFloatData;
typedef VfetchError (*CustomArgParserFunc)(int *idx,
int argc,
const char *argv[],
VfetchArgs *args);
typedef struct ArgumentHandler {
union {
BoundedFloatData bounded_float;
CustomArgParserFunc custom_parser;
const char *chafa_key;
size_t boolean_offset;
} data;
const char *name;
ArgHandlerType type;
} ArgumentHandler;
#endif /* SRC__CONFIG_H */
|