Add target to split automatically
This commit is contained in:
		
							parent
							
								
									6dddeb9c2e
								
							
						
					
					
						commit
						1752ef64d8
					
				
					 2 changed files with 21 additions and 3 deletions
				
			
		|  | @ -12,6 +12,9 @@ commands: | ||||||
|     default: force |     default: force | ||||||
|   - name: quick |   - name: quick | ||||||
|   - name: split |   - name: split | ||||||
|  |     args: | ||||||
|  |       - name: target | ||||||
|  |         required: false | ||||||
|   - name: move |   - name: move | ||||||
|     args: |     args: | ||||||
|       - name: channel |       - name: channel | ||||||
|  |  | ||||||
|  | @ -1,3 +1,5 @@ | ||||||
|  | target="${args[target]}" | ||||||
|  | 
 | ||||||
| ts_clients=$(teamspeak-query-lib clients --uid) | ts_clients=$(teamspeak-query-lib clients --uid) | ||||||
| ts_online=$(grep ~/.config/ts-control/steam_map.txt -Ff <(echo "$ts_clients" | awk '{print $1}')) | ts_online=$(grep ~/.config/ts-control/steam_map.txt -Ff <(echo "$ts_clients" | awk '{print $1}')) | ||||||
| friend_ids=$(echo "$ts_online" | awk '{print $1}' | paste -sd ',') | friend_ids=$(echo "$ts_online" | awk '{print $1}' | paste -sd ',') | ||||||
|  | @ -47,13 +49,26 @@ create_prompt() { | ||||||
| groups=$(create_groups) | groups=$(create_groups) | ||||||
| prompt=$(create_prompt "$groups") | prompt=$(create_prompt "$groups") | ||||||
| 
 | 
 | ||||||
| selected=$(echo "$prompt" | $DMENU) | filter="" | ||||||
|  | 
 | ||||||
|  | if [ -n "$target" ] | ||||||
|  | then | ||||||
|  |   filter="^.  *$target$" # START INDEX SPACES TARGET (broken for index > 9) | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | selected=$(_ts_control_single_or_dmenu "$prompt" "$filter") | ||||||
| if [ -z "$selected" ]; then | if [ -z "$selected" ]; then | ||||||
|   exit 1 |   exit 1 | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
|  | target_channel="" | ||||||
|  | if [ -z "$target" ] # ask for channel if no target is specified | ||||||
|  | then | ||||||
|   target_channel=$(teamspeak-query-lib channels | $DMENU --prompt "Channel" || true) |   target_channel=$(teamspeak-query-lib channels | $DMENU --prompt "Channel" || true) | ||||||
| if [ -z "$target_channel" ]; then | fi | ||||||
|  | 
 | ||||||
|  | if [ -z "$target_channel" ] # use first empty channel if no channel is specified | ||||||
|  | then | ||||||
|   target_channel=$(teamspeak-query-lib channels --only-empty | head -n 1) |   target_channel=$(teamspeak-query-lib channels --only-empty | head -n 1) | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue