Fix some bugs in the ls command parsing ##shell

This commit is contained in:
dvertx 2023-06-20 04:57:15 +07:00 committed by GitHub
parent 70bf77114b
commit 7dd134283a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,20 +177,15 @@ R_API char *r_syscmd_ls(const char *input, int cons_width) {
}
if ((!strncmp (input, "-e", 2))) {
printfmt = FMT_EMOJI;
path = r_str_trim_head_ro (path + 1);
path = r_str_trim_head_ro (input + 2);
} else if ((!strncmp (input, "-q", 2))) {
printfmt = FMT_QUIET;
path = r_str_trim_head_ro (path + 1);
path = r_str_trim_head_ro (input + 2);
} else if ((!strncmp (input, "-l", 2)) || (!strncmp (input, "-j", 2))) {
// mode = 'l';
if (input[2]) {
printfmt = (input[2] == 'j') ? FMT_JSON : FMT_RAW;
path = r_str_trim_head_ro (input + 2);
if (!*path) {
path = ".";
}
} else {
printfmt = FMT_RAW;
printfmt = (input[1] == 'j') ? FMT_JSON : FMT_RAW;
path = r_str_trim_head_ro (input + 2);
if (!*path) {
path = ".";
}
} else {
path = input;