vcomplete: add powershell support (#9093)
							parent
							
								
									0f8f8bd90d
								
							
						
					
					
						commit
						76c8dea782
					
				| 
						 | 
					@ -29,7 +29,13 @@
 | 
				
			||||||
// ```
 | 
					// ```
 | 
				
			||||||
// Please note that you should let v load the zsh completions after the call to compinit
 | 
					// Please note that you should let v load the zsh completions after the call to compinit
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// # powershell //TODO
 | 
					// # powershell
 | 
				
			||||||
 | 
					// To install auto-complete for V in PowerShell, simply do this
 | 
				
			||||||
 | 
					// `v complete setup powershell >> $PROFILE`
 | 
				
			||||||
 | 
					// and reload profile
 | 
				
			||||||
 | 
					// `& $PROFILE`
 | 
				
			||||||
 | 
					// If `$PROFILE` didn't exist yet, create it before
 | 
				
			||||||
 | 
					// `New-Item -Type File -Force $PROFILE`
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
module main
 | 
					module main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -248,7 +254,14 @@ _v() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
compdef _v v
 | 
					compdef _v v
 | 
				
			||||||
' }
 | 
					' }
 | 
				
			||||||
				// 'powershell' {} //TODO
 | 
									'powershell' { setup = '
 | 
				
			||||||
 | 
					Register-ArgumentCompleter -Native -CommandName v -ScriptBlock {
 | 
				
			||||||
 | 
						param(\$commandName, \$wordToComplete, \$cursorPosition)
 | 
				
			||||||
 | 
							$vexe complete powershell "\$wordToComplete" | ForEach-Object {
 | 
				
			||||||
 | 
								[System.Management.Automation.CompletionResult]::new(\$_, \$_, \'ParameterValue\', \$_)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					' }
 | 
				
			||||||
				else {}
 | 
									else {}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			println(setup)
 | 
								println(setup)
 | 
				
			||||||
| 
						 | 
					@ -264,7 +277,7 @@ compdef _v v
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			println(lines.join('\n'))
 | 
								println(lines.join('\n'))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		'fish' {
 | 
							'fish', 'powershell' {
 | 
				
			||||||
			if sub_args.len <= 1 {
 | 
								if sub_args.len <= 1 {
 | 
				
			||||||
				exit(0)
 | 
									exit(0)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -286,7 +299,6 @@ compdef _v v
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			println(lines.join('\n'))
 | 
								println(lines.join('\n'))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// 'powershell' {} //TODO
 | 
					 | 
				
			||||||
		else {}
 | 
							else {}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	exit(0)
 | 
						exit(0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue