PowerShell下Maven自动补全
2022-05-03 • 预计阅读时间 1 分钟
2022-05-03 • 预计阅读时间 1 分钟
类似上篇的处理,给Maven的不同 phase
也增加了自动补全.
只增加了一些常用的,在Maven – Available Plugins这里有比较全的内容.
Register-ArgumentCompleter -CommandName mvn -Native -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
$lstCmd = "build","clean","sit","validate","compile","test","package","verify","install","deploy","-DskipTests","-Dmaven.test.skip=true"
foreach ($cmd in $lstCmd) {
if ($cmd -like "$wordToComplete*") {
$cmd
}
}
}