mirror of
				https://github.com/tmux-plugins/tmux-resurrect.git
				synced 2025-11-04 00:46:04 +00:00 
			
		
		
		
	Implement save command strategy: pgrep
This commit is contained in:
		@@ -3,6 +3,7 @@
 | 
			
		||||
### master
 | 
			
		||||
- plugin now uses strategies when fetching pane full command. Implemented
 | 
			
		||||
  'default' strategy.
 | 
			
		||||
- save command strategy: 'pgrep'. It's here only if fallback is needed.
 | 
			
		||||
 | 
			
		||||
### v1.3.0, 2014-09-20
 | 
			
		||||
- remove dependency on `pgrep` command. Use `ps` for fetching process names.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								save_command_strategies/pgrep.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								save_command_strategies/pgrep.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 | 
			
		||||
 | 
			
		||||
PANE_PID="$1"
 | 
			
		||||
 | 
			
		||||
exit_safely_if_empty_ppid() {
 | 
			
		||||
	if [ -z "$PANE_PID" ]; then
 | 
			
		||||
		exit 0
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
full_command() {
 | 
			
		||||
	\pgrep -lf -P "$PANE_PID" |
 | 
			
		||||
		cut -d' ' -f2-
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
main() {
 | 
			
		||||
	exit_safely_if_empty_ppid
 | 
			
		||||
	full_command
 | 
			
		||||
}
 | 
			
		||||
main
 | 
			
		||||
		Reference in New Issue
	
	Block a user