diff options
| author | 2019-03-09 09:05:32 +0530 | |
|---|---|---|
| committer | 2019-03-09 09:15:04 +0530 | |
| commit | 5dd5710b310a79652e092631d29313b83f33e8bb (patch) | |
| tree | d2e5c2ea819e4113b600289c13d23316616184f8 /src | |
| parent | 090e55c74ac130926cdc9a8bd707469ca0e12445 (diff) | |
| download | nnn-5dd5710b310a79652e092631d29313b83f33e8bb.tar.gz | |
Support trash-cli to trash
Diffstat (limited to 'src')
| -rw-r--r-- | src/nnn.c | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -1141,20 +1141,32 @@ static void mvstr(char *buf) static void rmmulstr(char *buf) { - snprintf(buf, CMD_LEN_MAX, + if (cfg.trash) { + snprintf(buf, CMD_LEN_MAX, +#ifdef __linux__ + "xargs -0 -a %s trash-put", g_cppath); +#else + "cat %s | xargs -0 trash-put", g_cppath); +#endif + } else { + snprintf(buf, CMD_LEN_MAX, #ifdef __linux__ - "xargs -0 -a %s rm -%cr", + "xargs -0 -a %s rm -%cr", g_cppath, confirm_force()); #else - "cat %s | xargs -0 -o rm -%cr", + "cat %s | xargs -0 -o rm -%cr", g_cppath, confirm_force()); #endif - g_cppath, confirm_force()); + } } static void xrm(char *path) { - char rm_opts[] = {'-', confirm_force(), 'r'}; + if (cfg.trash) + spawn("trash-put", path, NULL, NULL, F_NORMAL | F_SIGINT); + else { + char rm_opts[] = {'-', confirm_force(), 'r'}; - spawn("rm", rm_opts, path, NULL, F_NORMAL | F_SIGINT); + spawn("rm", rm_opts, path, NULL, F_NORMAL | F_SIGINT); + } } static void archive_selection(const char *archive, const char *curpath) |