userctl: Place library path before command
This commit is contained in:
@@ -13,22 +13,20 @@ Noh_Arena temp;
|
|||||||
|
|
||||||
static void show_usage(char *program_name, char *error) {
|
static void show_usage(char *program_name, char *error) {
|
||||||
noh_log(NOH_INFO, "Usage:");
|
noh_log(NOH_INFO, "Usage:");
|
||||||
noh_log(NOH_INFO, "%s command [args]", program_name);
|
noh_log(NOH_INFO, "%s command library_path [args]", program_name);
|
||||||
|
noh_log(NOH_INFO, " library_path: The path to the library where the users file and user subfolders are located.");
|
||||||
noh_log(NOH_INFO, "");
|
noh_log(NOH_INFO, "");
|
||||||
noh_log(NOH_INFO, "Commands:");
|
noh_log(NOH_INFO, "Commands:");
|
||||||
noh_log(NOH_INFO, "%s register library_path username password", program_name);
|
noh_log(NOH_INFO, "%s register username password", program_name);
|
||||||
noh_log(NOH_INFO, " library_path: The path to the library where the users file and user subfolders are located.");
|
|
||||||
noh_log(NOH_INFO, " username: The username of the user to register.");
|
noh_log(NOH_INFO, " username: The username of the user to register.");
|
||||||
noh_log(NOH_INFO, " password: The password of the user to register.");
|
noh_log(NOH_INFO, " password: The password of the user to register.");
|
||||||
noh_log(NOH_INFO, "Registers a new user, or changes their password if they already exist.");
|
noh_log(NOH_INFO, "Registers a new user, or changes their password if they already exist.");
|
||||||
noh_log(NOH_INFO, "");
|
noh_log(NOH_INFO, "");
|
||||||
noh_log(NOH_INFO, "%s delete library_path username", program_name);
|
noh_log(NOH_INFO, "%s delete username", program_name);
|
||||||
noh_log(NOH_INFO, " library_path: The path to the library where the users file and user subfolders are located.");
|
|
||||||
noh_log(NOH_INFO, " username: The username of the user to delete.");
|
noh_log(NOH_INFO, " username: The username of the user to delete.");
|
||||||
noh_log(NOH_INFO, "Deletes a user, optionally also deleting their library folder.");
|
noh_log(NOH_INFO, "Deletes a user, optionally also deleting their library folder.");
|
||||||
noh_log(NOH_INFO, "");
|
noh_log(NOH_INFO, "");
|
||||||
noh_log(NOH_INFO, "%s list library_path", program_name);
|
noh_log(NOH_INFO, "%s list", program_name);
|
||||||
noh_log(NOH_INFO, " library_path: The path to the library where the users file and user subfolders are located.");
|
|
||||||
noh_log(NOH_INFO, "Lists all users defined in the provided library path.");
|
noh_log(NOH_INFO, "Lists all users defined in the provided library path.");
|
||||||
noh_log(NOH_INFO, "");
|
noh_log(NOH_INFO, "");
|
||||||
noh_log(NOH_ERROR, "%s", error);
|
noh_log(NOH_ERROR, "%s", error);
|
||||||
@@ -237,12 +235,12 @@ int main(int argc, char **argv) {
|
|||||||
// Parse input parameters.
|
// Parse input parameters.
|
||||||
char *program_name = noh_shift_args(&argc, &argv);
|
char *program_name = noh_shift_args(&argc, &argv);
|
||||||
|
|
||||||
if (argc < 1) show_usage(program_name, "Command not provided");
|
|
||||||
Noh_String_View command = noh_sv_from_cstr(noh_shift_args(&argc, &argv));
|
|
||||||
|
|
||||||
if (argc < 1) show_usage(program_name, "Library path not provided.");
|
if (argc < 1) show_usage(program_name, "Library path not provided.");
|
||||||
Noh_String_View library_path = noh_sv_from_cstr(noh_shift_args(&argc, &argv));
|
Noh_String_View library_path = noh_sv_from_cstr(noh_shift_args(&argc, &argv));
|
||||||
|
|
||||||
|
if (argc < 1) show_usage(program_name, "Command not provided");
|
||||||
|
Noh_String_View command = noh_sv_from_cstr(noh_shift_args(&argc, &argv));
|
||||||
|
|
||||||
if (noh_sv_eq_ci(command, noh_sv_from_cstr("register"))) {
|
if (noh_sv_eq_ci(command, noh_sv_from_cstr("register"))) {
|
||||||
if (argc < 1) show_usage(program_name, "Username not provided.");
|
if (argc < 1) show_usage(program_name, "Username not provided.");
|
||||||
Noh_String_View username = noh_sv_from_cstr(noh_shift_args(&argc, &argv));
|
Noh_String_View username = noh_sv_from_cstr(noh_shift_args(&argc, &argv));
|
||||||
|
|||||||
Reference in New Issue
Block a user