export NNN_PLUG='y:-!sync*'
5. To run a \fIGUI app as plugin\fR, add a \fB&\fR after \fB!\fR
+ Note: $nnn must be the last argument in this case.
export NNN_PLUG='m:-!&mousepad $nnn'
export NNN_PLUG='m:-!&mousepad $nnn'
```
+Note: $nnn must be the last argument in this case.
+
#### Page non-interactive command output
To show the output of run-and-exit commands which do not need user input, add `|` (pipe) after `!`.
}
}
-static bool run_cmd_as_plugin(const char *file, uchar_t flags)
+static bool run_cmd_as_plugin(const char *file, char *runfile, uchar_t flags)
{
size_t len;
}
if (flags & F_PAGE)
- get_output(utils[UTIL_SH_EXEC], g_buf, NULL, -1, TRUE, TRUE);
- else
+ get_output(g_buf, NULL, NULL, -1, TRUE, TRUE);
+ else if (flags & F_NOTRACE) {
+ if (is_suffix(g_buf, " $nnn"))
+ g_buf[len - 5] = '\0';
+ else
+ runfile = NULL;
+ spawn(g_buf, runfile, NULL, NULL, flags);
+ } else
spawn(utils[UTIL_SH_EXEC], g_buf, NULL, NULL, flags);
return TRUE;
return FALSE;
if ((flags & F_NOTRACE) || (flags & F_PAGE))
- return run_cmd_as_plugin(file, flags);
+ return run_cmd_as_plugin(file, runfile, flags);
cmd_as_plugin = TRUE;
}
} else
spawn(g_buf, NULL, *path, sel, 0);
} else
- run_cmd_as_plugin(file, flags);
+ run_cmd_as_plugin(file, NULL, flags);
close(wfd);
_exit(EXIT_SUCCESS);