mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	Add an argument to list-commands to show only a single command.
This commit is contained in:
		@@ -47,8 +47,8 @@ const struct cmd_entry cmd_list_commands_entry = {
 | 
				
			|||||||
	.name = "list-commands",
 | 
						.name = "list-commands",
 | 
				
			||||||
	.alias = "lscm",
 | 
						.alias = "lscm",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.args = { "F:", 0, 0 },
 | 
						.args = { "F:", 0, 1 },
 | 
				
			||||||
	.usage = "[-F format]",
 | 
						.usage = "[-F format] [command]",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.flags = CMD_STARTSERVER|CMD_AFTERHOOK,
 | 
						.flags = CMD_STARTSERVER|CMD_AFTERHOOK,
 | 
				
			||||||
	.exec = cmd_list_keys_exec
 | 
						.exec = cmd_list_keys_exec
 | 
				
			||||||
@@ -317,9 +317,12 @@ cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
	const struct cmd_entry	**entryp;
 | 
						const struct cmd_entry	**entryp;
 | 
				
			||||||
	const struct cmd_entry	 *entry;
 | 
						const struct cmd_entry	 *entry;
 | 
				
			||||||
	struct format_tree	 *ft;
 | 
						struct format_tree	 *ft;
 | 
				
			||||||
	const char		 *template, *s;
 | 
						const char		 *template, *s, *command = NULL;
 | 
				
			||||||
	char			 *line;
 | 
						char			 *line;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (args->argc != 0)
 | 
				
			||||||
 | 
							command = args->argv[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((template = args_get(args, 'F')) == NULL) {
 | 
						if ((template = args_get(args, 'F')) == NULL) {
 | 
				
			||||||
		template = "#{command_list_name}"
 | 
							template = "#{command_list_name}"
 | 
				
			||||||
		    "#{?command_list_alias, (#{command_list_alias}),} "
 | 
							    "#{?command_list_alias, (#{command_list_alias}),} "
 | 
				
			||||||
@@ -331,6 +334,11 @@ cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	for (entryp = cmd_table; *entryp != NULL; entryp++) {
 | 
						for (entryp = cmd_table; *entryp != NULL; entryp++) {
 | 
				
			||||||
		entry = *entryp;
 | 
							entry = *entryp;
 | 
				
			||||||
 | 
							if (command != NULL &&
 | 
				
			||||||
 | 
							    (strcmp(entry->name, command) != 0 &&
 | 
				
			||||||
 | 
							    (entry->alias == NULL ||
 | 
				
			||||||
 | 
							    strcmp(entry->alias, command) != 0)))
 | 
				
			||||||
 | 
							    continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		format_add(ft, "command_list_name", "%s", entry->name);
 | 
							format_add(ft, "command_list_name", "%s", entry->name);
 | 
				
			||||||
		if (entry->alias != NULL)
 | 
							if (entry->alias != NULL)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								tmux.1
									
									
									
									
									
								
							@@ -1048,9 +1048,12 @@ If
 | 
				
			|||||||
is specified, list only clients connected to that session.
 | 
					is specified, list only clients connected to that session.
 | 
				
			||||||
.It Xo Ic list-commands
 | 
					.It Xo Ic list-commands
 | 
				
			||||||
.Op Fl F Ar format
 | 
					.Op Fl F Ar format
 | 
				
			||||||
 | 
					.Op Ar command
 | 
				
			||||||
.Xc
 | 
					.Xc
 | 
				
			||||||
.D1 (alias: Ic lscm )
 | 
					.D1 (alias: Ic lscm )
 | 
				
			||||||
List the syntax of all commands supported by
 | 
					List the syntax of
 | 
				
			||||||
 | 
					.Ar command
 | 
				
			||||||
 | 
					or - if omitted - of all commands supported by
 | 
				
			||||||
.Nm .
 | 
					.Nm .
 | 
				
			||||||
.It Ic list-sessions Op Fl F Ar format
 | 
					.It Ic list-sessions Op Fl F Ar format
 | 
				
			||||||
.D1 (alias: Ic ls )
 | 
					.D1 (alias: Ic ls )
 | 
				
			||||||
@@ -2731,7 +2734,7 @@ command.
 | 
				
			|||||||
.It Xo Ic list-keys
 | 
					.It Xo Ic list-keys
 | 
				
			||||||
.Op Fl 1aN
 | 
					.Op Fl 1aN
 | 
				
			||||||
.Op Fl P Ar prefix-string Fl T Ar key-table
 | 
					.Op Fl P Ar prefix-string Fl T Ar key-table
 | 
				
			||||||
.Op key
 | 
					.Op Ar key
 | 
				
			||||||
.Xc
 | 
					.Xc
 | 
				
			||||||
.D1 (alias: Ic lsk )
 | 
					.D1 (alias: Ic lsk )
 | 
				
			||||||
List key bindings.
 | 
					List key bindings.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user