changeset 32:404be85de083

ssh: add args argument
author David Demelier <markand@malikania.fr>
date Mon, 30 Apr 2018 13:13:23 +0200
parents 7ce29c196f36
children f4c4e7161f81
files dmenu-ssh/main.cpp
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dmenu-ssh/main.cpp	Fri Apr 27 17:03:00 2018 +0200
+++ b/dmenu-ssh/main.cpp	Mon Apr 30 13:13:23 2018 +0200
@@ -43,6 +43,17 @@
     return std::string(home) + "/.ssh/config";
 }
 
+auto args() -> std::vector<std::string>
+{
+    const auto section = dmenu::config("ssh");
+    const auto it = section.find("args");
+
+    if (it == section.end())
+        return { "-p ssh" };
+
+    return *it;
+}
+
 auto list() -> std::vector<std::string>
 {
     std::ifstream config(path());
@@ -75,7 +86,7 @@
 
 auto menu() -> std::string
 {
-    return dmenu::run({ "-l 16", "-p ssh" }, list());
+    return dmenu::run(args(), list());
 }
 
 void exec(const std::string& host)