fe
terminal file explorer and picker
git clone https://9o.is/git/fe.git
fe.c
(864B)
1 #include <stdio.h>
2 #include <string.h>
3 #include <stdlib.h>
4 #include <ctype.h>
5 #include <limits.h>
6 #include <unistd.h>
7 #include "tty.h"
8 #include "entries.h"
9 #include "options.h"
10 #include "tty_interface.h"
11 #include "config.h"
12
13 int main(int argc, char *argv[]) {
14 options_t options = default_options;
15 options_parse(&options, argc, argv);
16
17 entries_t entries;
18 entries_init(&entries, &options);
19
20 if (options.path)
21 entries_init_path(&entries, options.path);
22 else if (!isatty(STDIN_FILENO))
23 entries_init_stdinpath(&entries);
24 else
25 entries_init_path(&entries, NULL);
26
27 tty_t tty;
28 tty_init(&tty, options.tty_filename);
29
30 tty_interface_t tty_interface;
31 tty_interface_init(&tty_interface, &tty, &entries, &options);
32 int ret = tty_interface_run(&tty_interface);
33
34 entries_destroy(&entries);
35 return ret;
36 }