Skip to content

Commit

Permalink
Fix line length
Browse files Browse the repository at this point in the history
  • Loading branch information
ZettZet committed Dec 19, 2022
1 parent aff87f5 commit dca6d89
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/cleo/commands/completions/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@
%(cmds_opts)s"""


POWERSHELL_TEMPLATE = """\
POWERSHELL_TEMPLATE = (
"""\
$%(function)s = {
param(
[string] $wordToComplete,
Expand All @@ -133,19 +134,23 @@
$options = %(opts)s
$commands = %(cmds)s
if ($wordToComplete -notlike '--*' -and $wordToComplete -notlike "" -and ($commandAst.CommandElements.Count -eq "2")) {
if ($wordToComplete -notlike '--*' -and $wordToComplete -notlike "" -and """
"""($commandAst.CommandElements.Count -eq "2")) {
return $commands | Where-Object { $_ -like "$wordToComplete*" }
}
$result = $commandAst.CommandElements | Select-Object -Skip 1 | Where-Object { $_ -notlike '--*' }
$result = $commandAst.CommandElements | Select-Object -Skip 1 | """
"""Where-Object { $_ -notlike '--*' }
switch ($result -Join " " ) {
%(cmds_opts)s
}
return $options | Where-Object { $_ -like "$wordToComplete*" }
}
Register-ArgumentCompleter -Native -CommandName %(script_name)s -ScriptBlock $%(function)s"""
Register-ArgumentCompleter -Native -CommandName %(script_name)s """
"""-ScriptBlock $%(function)s"""
)

TEMPLATES = {
"bash": BASH_TEMPLATE,
Expand Down

0 comments on commit dca6d89

Please sign in to comment.