chore(landerctl): remove dead code
This commit is contained in:
parent
16a7af6865
commit
40a895673c
4 changed files with 28 additions and 370 deletions
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
#include <curl/curl.h>
|
||||
|
||||
/**
|
||||
* Represents a parsed config file
|
||||
*/
|
||||
typedef struct landerctl_cfg {
|
||||
const char *api_key;
|
||||
const char *server_url;
|
||||
|
|
@ -33,23 +36,9 @@ typedef enum landerctl_mode {
|
|||
landerctl_mode_file,
|
||||
} landerctl_mode;
|
||||
|
||||
typedef enum landerctl_err {
|
||||
landerctl_err_ok = 0,
|
||||
landerctl_err_not_found
|
||||
} landerctl_err;
|
||||
|
||||
typedef struct landerctl_ctx {
|
||||
landerctl_cfg cfg;
|
||||
landerctl_mode mode;
|
||||
bool secure;
|
||||
bool verbose;
|
||||
const char *arg;
|
||||
const char *key;
|
||||
CURL *curl;
|
||||
struct curl_slist *headers;
|
||||
FILE *data_file;
|
||||
} landerctl_ctx;
|
||||
|
||||
/**
|
||||
* Represents parsed CLI arguments
|
||||
*/
|
||||
typedef struct landerctl_args {
|
||||
bool secure;
|
||||
bool verbose;
|
||||
|
|
@ -61,30 +50,45 @@ typedef struct landerctl_args {
|
|||
landerctl_mode mode;
|
||||
} landerctl_args;
|
||||
|
||||
/**
|
||||
* Convenience wrapper around a CURL object
|
||||
*/
|
||||
typedef struct landerctl_curl {
|
||||
CURL *curl;
|
||||
struct curl_slist *headers;
|
||||
char err_msg[CURL_ERROR_SIZE];
|
||||
} landerctl_curl;
|
||||
|
||||
const char *landerctl_err_msg(landerctl_err err);
|
||||
|
||||
void landerctl_set_common(landerctl_ctx *ctx);
|
||||
landerctl_err landerctl_post_short(landerctl_ctx *ctx);
|
||||
landerctl_err landerctl_post_paste(landerctl_ctx *ctx);
|
||||
landerctl_err landerctl_post_file(landerctl_ctx *ctx);
|
||||
|
||||
int landerctl_parse_args(landerctl_args *out, int argc, char **argv);
|
||||
|
||||
int landerctl_cmd_short(landerctl_args *args);
|
||||
int landerctl_cmd_paste(landerctl_args *args);
|
||||
int landerctl_cmd_file(landerctl_args *args);
|
||||
|
||||
/**
|
||||
* Initialize a CURL object
|
||||
*/
|
||||
int landerctl_curl_init(landerctl_curl *out);
|
||||
|
||||
/**
|
||||
* Set common configurations for the CURL shared across all commands
|
||||
*/
|
||||
int landerctl_curl_set_common(landerctl_curl *curl, landerctl_args *args,
|
||||
const char *key);
|
||||
|
||||
/**
|
||||
* Execute the HTTP request configured in the CURL object
|
||||
*/
|
||||
int landerctl_curl_perform(landerctl_curl *curl);
|
||||
|
||||
/**
|
||||
* Inspect the response code and Location header of a successful HTTP request
|
||||
*/
|
||||
int landerctl_curl_inspect(landerctl_curl *curl, landerctl_args *args);
|
||||
|
||||
/**
|
||||
* Deallocate the CURL object
|
||||
*/
|
||||
void landerctl_curl_cleanup(landerctl_curl *curl);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue