Improve completions workflow
This commit is contained in:
		
							parent
							
								
									031bb45eeb
								
							
						
					
					
						commit
						6c2eeb4c9b
					
				
					 3 changed files with 15 additions and 6 deletions
				
			
		
							
								
								
									
										6
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -14,13 +14,9 @@ generate: get-target output-dir | |||
| generate-upgrade: get-target output-dir | ||||
| 	BASHLY_SOURCE_DIR=$(TARGET) bashly generate --upgrade | ||||
| 
 | ||||
| completions: generate-upgrade | ||||
| 	BASHLY_SOURCE_DIR=$(TARGET) bashly add --force completions_script ./output/_$(TARGET) | ||||
| 
 | ||||
| docs: generate | ||||
| 	BASHLY_SOURCE_DIR=$(TARGET) bashly render :mandoc ./output/man1 | ||||
| 
 | ||||
| deploy: completions docs | ||||
| deploy: generate docs | ||||
| 	cp -f ./output/$(TARGET) ~/.local/bin/ | ||||
| 	cp -f ./output/_$(TARGET) ~/.config/completionsrc.d/ | ||||
| 	cp -f ./output/man1/$(TARGET)*.1 ~/.local/share/man/man1/ | ||||
|  |  | |||
|  | @ -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