diff options
Diffstat (limited to 'util/fbrun/main.cc')
-rw-r--r-- | util/fbrun/main.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/util/fbrun/main.cc b/util/fbrun/main.cc index 4022ef6..a8655ab 100644 --- a/util/fbrun/main.cc +++ b/util/fbrun/main.cc | |||
@@ -66,6 +66,7 @@ void showUsage(const char *progname) { | |||
66 | " -bg [color name] Background color"<<endl<< | 66 | " -bg [color name] Background color"<<endl<< |
67 | " -na Disable antialias"<<endl<< | 67 | " -na Disable antialias"<<endl<< |
68 | " -hf [history file] History file to load (default ~/.fluxbox/fbrun_history)"<<endl<< | 68 | " -hf [history file] History file to load (default ~/.fluxbox/fbrun_history)"<<endl<< |
69 | " -cf [completion file] Complete contents of this file instead of $PATH binaries"<<endl<< | ||
69 | " -autocomplete Complete on typing"<<endl<< | 70 | " -autocomplete Complete on typing"<<endl<< |
70 | " -preselect Select preset text"<<endl<< | 71 | " -preselect Select preset text"<<endl<< |
71 | " -help Show this help"<<endl<<endl<< | 72 | " -help Show this help"<<endl<<endl<< |
@@ -89,6 +90,7 @@ int main(int argc, char **argv) { | |||
89 | string background("white"); // text background color | 90 | string background("white"); // text background color |
90 | string display_name; // name of the display connection | 91 | string display_name; // name of the display connection |
91 | string history_file("~/.fluxbox/fbrun_history"); // command history file | 92 | string history_file("~/.fluxbox/fbrun_history"); // command history file |
93 | string completion_file; // command history file | ||
92 | // parse arguments | 94 | // parse arguments |
93 | for (int i=1; i<argc; i++) { | 95 | for (int i=1; i<argc; i++) { |
94 | string arg = argv[i]; | 96 | string arg = argv[i]; |
@@ -124,6 +126,8 @@ int main(int argc, char **argv) { | |||
124 | background = argv[++i]; | 126 | background = argv[++i]; |
125 | } else if (strcmp(argv[i], "-hf") == 0 && i+1 < argc) { | 127 | } else if (strcmp(argv[i], "-hf") == 0 && i+1 < argc) { |
126 | history_file = argv[++i]; | 128 | history_file = argv[++i]; |
129 | } else if (strcmp(argv[i], "-cf") == 0 && i+1 < argc) { | ||
130 | completion_file = argv[++i]; | ||
127 | } else if (strcmp(argv[i], "-preselect") == 0) { | 131 | } else if (strcmp(argv[i], "-preselect") == 0) { |
128 | preselect = true; | 132 | preselect = true; |
129 | } else if (strcmp(argv[i], "-autocomplete") == 0) { | 133 | } else if (strcmp(argv[i], "-autocomplete") == 0) { |
@@ -171,6 +175,12 @@ int main(int argc, char **argv) { | |||
171 | if (!fbrun.loadHistory(expanded_filename.c_str())) | 175 | if (!fbrun.loadHistory(expanded_filename.c_str())) |
172 | cerr<<"FbRun Warning: Failed to load history file: "<<expanded_filename<<endl; | 176 | cerr<<"FbRun Warning: Failed to load history file: "<<expanded_filename<<endl; |
173 | 177 | ||
178 | if (!completion_file.empty()) { | ||
179 | expanded_filename = FbTk::StringUtil::expandFilename(completion_file); | ||
180 | if (!fbrun.loadCompletion(expanded_filename.c_str())) | ||
181 | cerr<<"FbRun Warning: Failed to load completion file: "<<expanded_filename<<endl; | ||
182 | } | ||
183 | |||
174 | fbrun.setTitle(title); | 184 | fbrun.setTitle(title); |
175 | fbrun.setText(text); | 185 | fbrun.setText(text); |
176 | if (preselect) | 186 | if (preselect) |