Project is published.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define CFG_MAX 512
|
||||
|
||||
typedef struct {
|
||||
char git_url[CFG_MAX];
|
||||
char git_user[256];
|
||||
char git_token[256];
|
||||
char git_password[256];
|
||||
char default_target[128];
|
||||
char clone_dir[CFG_MAX];
|
||||
bool log_enabled;
|
||||
char log_dir[CFG_MAX];
|
||||
} GConfig;
|
||||
|
||||
void config_defaults(GConfig *cfg);
|
||||
int config_load(GConfig *cfg, const char *path);
|
||||
int config_save(const GConfig *cfg, const char *path);
|
||||
int config_init(const char *path, bool force);
|
||||
void config_show(const GConfig *cfg);
|
||||
void config_get_path(char *out, size_t n);
|
||||
char *expand_tilde(const char *in, char *out, size_t n);
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef GIT_OPS_H
|
||||
#define GIT_OPS_H
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
/* Returns 1 if clone_dir/project/.git exists, 0 otherwise */
|
||||
int git_repo_exists(const char *clone_dir, const char *project);
|
||||
|
||||
/* Clone repo under clone_dir/project using token or password auth */
|
||||
int git_clone(const char *base_url, const char *user,
|
||||
const char *token, const char *password,
|
||||
const char *project, const char *clone_dir,
|
||||
Logger *log);
|
||||
|
||||
/* Pull latest in repo_path */
|
||||
int git_pull(const char *repo_path, Logger *log);
|
||||
|
||||
#endif /* GIT_OPS_H */
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct {
|
||||
FILE *fp;
|
||||
char path[512];
|
||||
bool enabled;
|
||||
} Logger;
|
||||
|
||||
int logger_open (Logger *log, const char *log_dir, const char *project);
|
||||
void logger_close(Logger *log);
|
||||
|
||||
void logger_info (Logger *log, const char *fmt, ...);
|
||||
void logger_ok (Logger *log, const char *fmt, ...);
|
||||
void logger_warn (Logger *log, const char *fmt, ...);
|
||||
void logger_error(Logger *log, const char *fmt, ...);
|
||||
void logger_raw (Logger *log, const char *fmt, ...);
|
||||
|
||||
#endif /* LOGGER_H */
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef MAKE_OPS_H
|
||||
#define MAKE_OPS_H
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
#define MAX_TARGETS 256
|
||||
#define TARGET_NAME 128
|
||||
|
||||
typedef struct {
|
||||
char names[MAX_TARGETS][TARGET_NAME];
|
||||
int count;
|
||||
} MakeTargets;
|
||||
|
||||
int make_parse_targets(const char *repo_path, MakeTargets *out);
|
||||
int make_build(const char *repo_path, const char *target, Logger *log);
|
||||
|
||||
#endif /* MAKE_OPS_H */
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef TUI_H
|
||||
#define TUI_H
|
||||
|
||||
#include "make_ops.h"
|
||||
#include <stddef.h>
|
||||
|
||||
/* Arrow-key driven target picker.
|
||||
* Fills `selected` with the chosen target name.
|
||||
* Returns 0 on selection, -1 if the user cancelled (q / ESC). */
|
||||
int tui_pick_target(const MakeTargets *targets, char *selected, size_t sel_size);
|
||||
|
||||
/* Two-pane log browser: list on left, preview on right.
|
||||
* Keys: ↑↓ navigate Enter open in less d delete q quit */
|
||||
void tui_log_browser(const char *log_dir);
|
||||
|
||||
#endif /* TUI_H */
|
||||
Reference in New Issue
Block a user