File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -498,6 +498,10 @@ def get_completion() -> None:
498498 if not args :
499499 call_fallback (fallback )
500500 else :
501+ # we first need to figure out which command is being invoked
502+ # but we cant be sure which index the command name is at so
503+ # we try to fetch each in order and assume the first arg
504+ # that resolves to a command is the command
501505 cmd = None
502506 cmd_idx = - 1
503507 try :
@@ -519,6 +523,7 @@ def get_completion() -> None:
519523 raise # otherwise nowhere to go - just error out
520524
521525 if isinstance (cmd , TyperCommand ): # type: ignore[unreachable]
526+ # this will exit out so no return is needed here
522527 cmd .typer_app (
523528 args = args [cmd_idx + 1 :],
524529 standalone_mode = True ,
Original file line number Diff line number Diff line change @@ -318,6 +318,22 @@ def verify_remove(self, script=None):
318318 self .assertTrue (contents ) # should have been deleted if it were empty
319319
320320
321+ class PowerShellInstallRemoveTests (_InstalledScriptTestCase , PowerShellTests ):
322+
323+ def test_shell_complete (self ):
324+ # the power shell completion script registration is all in one file
325+ # so install/remove is more complicated when other scripts are in that
326+ # file - this tests that
327+ self .install (script = "./manage.py" )
328+ self .verify_install (script = "./manage.py" )
329+ self .install (script = self .manage_script )
330+ self .verify_install (script = self .manage_script )
331+ self .remove (script = self .manage_script )
332+ self .verify_remove (script = self .manage_script )
333+ self .remove (script = "./manage.py" )
334+ self .verify_remove (script = "./manage.py" )
335+
336+
321337@pytest .mark .skipif (default_shell is None , reason = "shellingham failed to detect shell" )
322338class DefaultCompleteTestCase (_DefaultCompleteTestCase , TestCase ):
323339 pass
You can’t perform that action at this time.
0 commit comments