Improve completions workflow
This commit is contained in:
		
							parent
							
								
									031bb45eeb
								
							
						
					
					
						commit
						6c2eeb4c9b
					
				
					 3 changed files with 15 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
name: autoinstall
 | 
			
		||||
help: Install files, repository and else
 | 
			
		||||
version: 0.1.0
 | 
			
		||||
version: 0.1.1
 | 
			
		||||
 | 
			
		||||
flags:
 | 
			
		||||
  - long: --clean
 | 
			
		||||
| 
						 | 
				
			
			@ -73,6 +73,10 @@ commands:
 | 
			
		|||
        help: Pipe file through command (e.g. "tar xzO")
 | 
			
		||||
        arg: pipe
 | 
			
		||||
        default: cat
 | 
			
		||||
      - long: --completions
 | 
			
		||||
        short: -c
 | 
			
		||||
        help: Run a command on the new exe to install completions
 | 
			
		||||
        arg: completions
 | 
			
		||||
 | 
			
		||||
  - name: archive
 | 
			
		||||
    help: Install an archive
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
pipe=${args[--pipe]:?}
 | 
			
		||||
target=${args[target]:?}
 | 
			
		||||
url=${args[url]:?}
 | 
			
		||||
completions=${args[completions]:-}
 | 
			
		||||
 | 
			
		||||
if [ "${action:-file}" = "exe" ]
 | 
			
		||||
then
 | 
			
		||||
| 
						 | 
				
			
			@ -10,6 +11,7 @@ then
 | 
			
		|||
	then
 | 
			
		||||
		return
 | 
			
		||||
	fi
 | 
			
		||||
	exe=$target
 | 
			
		||||
	target="$HOME/.local/bin/$target"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -27,6 +29,13 @@ then
 | 
			
		|||
	if [ "${action:-file}" = "exe" ]
 | 
			
		||||
	then
 | 
			
		||||
		chmod +x "$target"
 | 
			
		||||
 | 
			
		||||
		if [ -z "$completions" ]
 | 
			
		||||
		then
 | 
			
		||||
			echo "Installing completions for $exe"
 | 
			
		||||
			# shellcheck disable=SC2086
 | 
			
		||||
			"$target" $completions > "$XDG_CONFIG_HOME/completionsrc.d/_$(basename "$exe")"
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	_run_hook
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue