summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-05 22:25:34 -0500
committerJune McEnroe <june@causal.agency>2020-02-05 22:25:34 -0500
commit6ca54617ce1fe0ac4dbd8094e13b38a0aa375200 (patch)
treea0643dbcaffa9e0ac9f993b8c8c27d901dc07447
parentDocument commands in manual (diff)
downloadcatgirl-6ca54617ce1fe0ac4dbd8094e13b38a0aa375200.tar.gz
catgirl-6ca54617ce1fe0ac4dbd8094e13b38a0aa375200.zip
Add /window name variant
Diffstat (limited to '')
-rw-r--r--catgirl.12
-rw-r--r--command.c10
2 files changed, 10 insertions, 2 deletions
diff --git a/catgirl.1 b/catgirl.1
index e6d8efa..fb031c2 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -115,6 +115,8 @@ Send a raw IRC command.
 .
 .Ss UI Commands
 .Bl -tag -width Ds
+.It Ic /window Ar name
+Switch to window by name.
 .It Ic /window Ar num , Ic / Ns Ar num
 Switch to window by number.
 .El
diff --git a/command.c b/command.c
index f9362dc..e4f035f 100644
--- a/command.c
+++ b/command.c
@@ -14,6 +14,7 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
+#include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -64,8 +65,13 @@ static void commandQuit(size_t id, char *params) {
 }
 
 static void commandWindow(size_t id, char *params) {
-	(void)id;
-	if (params) uiShowNum(strtoul(params, NULL, 10));
+	if (!params) return;
+	if (isdigit(params[0])) {
+		uiShowNum(strtoul(params, NULL, 10));
+	} else {
+		id = idFind(params);
+		if (id) uiShowID(id);
+	}
 }
 
 static const struct Handler {